diff --git a/src/compile/dom/index.ts b/src/compile/dom/index.ts index f8fa646ccf..2cc5792d39 100644 --- a/src/compile/dom/index.ts +++ b/src/compile/dom/index.ts @@ -55,6 +55,10 @@ export default function dom( compiler.fragment.build(); const { block } = compiler.fragment; + if (compiler.options.nestedTransitions) { + block.hasOutroMethod = true; + } + // prevent fragment being created twice (#1063) if (options.customElement) block.builders.create.addLine(`this.c = @noop;`); diff --git a/test/runtime/samples/if-block-component-without-outro/Widget.html b/test/runtime/samples/if-block-component-without-outro/Widget.html new file mode 100644 index 0000000000..c66687863a --- /dev/null +++ b/test/runtime/samples/if-block-component-without-outro/Widget.html @@ -0,0 +1 @@ +
A wild component appears
\ No newline at end of file diff --git a/test/runtime/samples/if-block-component-without-outro/_config.js b/test/runtime/samples/if-block-component-without-outro/_config.js new file mode 100644 index 0000000000..c071648432 --- /dev/null +++ b/test/runtime/samples/if-block-component-without-outro/_config.js @@ -0,0 +1,15 @@ +export default { + skipIntroByDefault: true, + nestedTransitions: true, + + data: { + foo: true, + }, + + html: '
A wild component appears
', + + test(assert, component, target) { + component.set({ foo: false }); + assert.htmlEqual(target.innerHTML, ''); + }, +}; diff --git a/test/runtime/samples/if-block-component-without-outro/main.html b/test/runtime/samples/if-block-component-without-outro/main.html new file mode 100644 index 0000000000..f043b3644a --- /dev/null +++ b/test/runtime/samples/if-block-component-without-outro/main.html @@ -0,0 +1,11 @@ +{#if foo} + +{/if} + + \ No newline at end of file