always create outro method for top-level block - fixes #1470

pull/1479/head
Rich Harris 7 years ago
parent cffbd2709c
commit f97601ff1d

@ -55,6 +55,10 @@ export default function dom(
compiler.fragment.build(); compiler.fragment.build();
const { block } = compiler.fragment; const { block } = compiler.fragment;
if (compiler.options.nestedTransitions) {
block.hasOutroMethod = true;
}
// prevent fragment being created twice (#1063) // prevent fragment being created twice (#1063)
if (options.customElement) block.builders.create.addLine(`this.c = @noop;`); if (options.customElement) block.builders.create.addLine(`this.c = @noop;`);

@ -0,0 +1,15 @@
export default {
skipIntroByDefault: true,
nestedTransitions: true,
data: {
foo: true,
},
html: '<div>A wild component appears</div>',
test(assert, component, target) {
component.set({ foo: false });
assert.htmlEqual(target.innerHTML, '');
},
};

@ -0,0 +1,11 @@
{#if foo}
<Widget/>
{/if}
<script>
export default {
components: {
Widget: './Widget.html'
}
};
</script>
Loading…
Cancel
Save