Merge pull request #844 from sveltejs/gh-843

don't use skipped text nodes as anchors
pull/845/head
Rich Harris 7 years ago committed by GitHub
commit 129fb150bb

@ -417,6 +417,8 @@ function preprocessChildren(
const preprocessor = preprocessors[child.type];
if (preprocessor) preprocessor(generator, block, state, child, inEachBlock, elementStack, componentStack, stripWhitespace, cleaned[i + 1] || nextSibling);
if (child.shouldSkip) return;
if (lastChild) lastChild.next = child;
child.prev = lastChild;

@ -0,0 +1,25 @@
export default {
data: {
foo: ['a'],
bar: ['c']
},
html: `
<svg>
<g class='foo'>a</g>
<g class='bar'>c</g>
</svg>
`,
test(assert, component, target) {
component.set({ foo: ['a', 'b'] });
assert.htmlEqual(target.innerHTML, `
<svg>
<g class='foo'>a</g>
<g class='foo'>b</g>
<g class='bar'>c</g>
</svg>
`);
}
};

@ -0,0 +1,9 @@
<svg>
{{#each foo as x}}
<g class='foo'></g>
{{/each}}
{{#each bar as y}}
<g class='bar'></g>
{{/each}}
</svg>

After

Width:  |  Height:  |  Size: 119 B

Loading…
Cancel
Save