fix: join text nodes separated by comments (#13009)

pull/13015/head
Rich Harris 3 months ago committed by GitHub
parent ae27f27810
commit 96117fa44d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: join text nodes separated by comments

@ -60,9 +60,9 @@ export function process_children(nodes, initial, is_element, { visit, state }) {
* @param {Sequence} sequence * @param {Sequence} sequence
*/ */
function flush_sequence(sequence) { function flush_sequence(sequence) {
if (sequence.length === 1 && sequence[0].type === 'Text') { if (sequence.every((node) => node.type === 'Text')) {
skipped += 1; skipped += 1;
state.template.push(sequence[0].raw); state.template.push(sequence.map((node) => node.raw).join(''));
return; return;
} }

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: '<div>foobar</div>'
});
Loading…
Cancel
Save