dont use skipped text nodes as anchors - fixes #843

pull/844/head
Rich Harris 7 years ago
parent b64d95021a
commit 61476048c8

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