use anchor.parentNode as target instead of slot document fragment - fixes #850

pull/851/head
Rich Harris 7 years ago
parent 40df1c64ac
commit 0a0f474e43

@ -152,7 +152,7 @@ function simple(
`if (${name}) ${name}.${mountOrIntro}(${targetNode}, ${anchorNode});`
);
const parentNode = (state.parentNode && !needsAnchor) ? state.parentNode : `${anchor}.parentNode`;
const parentNode = isDomNode(node.parent, generator) ? node.parent.var : `${anchor}.parentNode`;
const enter = dynamic
? branch.hasIntroMethod
@ -255,7 +255,7 @@ function compound(
`${if_name}${name}.${mountOrIntro}(${targetNode}, ${anchorNode});`
);
const parentNode = (state.parentNode && !needsAnchor) ? state.parentNode : `${anchor}.parentNode`;
const parentNode = isDomNode(node.parent, generator) ? node.parent.var : `${anchor}.parentNode`;
const changeBlock = deindent`
${hasElse

@ -1,5 +1,4 @@
export default {
solo: true,
html: `
<div>
<p>unconditional</p>

@ -0,0 +1,13 @@
export default {
html: `
<p>disabled</p>
<p>unconditional</p>`,
test(assert, component, target) {
component.set({ enabled: true });
assert.htmlEqual(target.innerHTML, `
<p>enabled</p>
<p>unconditional</p>
`);
}
};

@ -0,0 +1,19 @@
<Nested>
{{#if !enabled}}
<p>disabled</p>
{{else}}
<p>enabled</p>
{{/if}}
<p>unconditional</p>
</Nested>
<script>
import Nested from './Nested.html';
export default {
components: {
Nested
}
};
</script>
Loading…
Cancel
Save