diff --git a/src/compile/render-dom/wrappers/IfBlock.ts b/src/compile/render-dom/wrappers/IfBlock.ts index 284cd241de12..3505ec9ce082 100644 --- a/src/compile/render-dom/wrappers/IfBlock.ts +++ b/src/compile/render-dom/wrappers/IfBlock.ts @@ -41,7 +41,7 @@ class IfBlockBranch extends Wrapper { ) }); - this.fragment = new FragmentWrapper(renderer, this.block, node.children, parent.parent, stripWhitespace, nextSibling); + this.fragment = new FragmentWrapper(renderer, this.block, node.children, parent, stripWhitespace, nextSibling); this.isDynamic = this.block.dependencies.size > 0; } diff --git a/test/runtime/samples/each-block-in-if-block/_config.js b/test/runtime/samples/each-block-in-if-block/_config.js new file mode 100644 index 000000000000..2af8c4bcd360 --- /dev/null +++ b/test/runtime/samples/each-block-in-if-block/_config.js @@ -0,0 +1,13 @@ +export default { + data: { + dummy: false, + fruits: ['Apple', 'Banana', 'Tomato'], + }, + + html: '
Apple
Banana
Tomato
', + + test ( assert, component, target ) { + component.set({ dummy: true }); + assert.htmlEqual(target.innerHTML, '
Apple
Banana
Tomato
' ); + } +}; diff --git a/test/runtime/samples/each-block-in-if-block/main.html b/test/runtime/samples/each-block-in-if-block/main.html new file mode 100644 index 000000000000..4c71f3e5b353 --- /dev/null +++ b/test/runtime/samples/each-block-in-if-block/main.html @@ -0,0 +1,7 @@ +
+ {#if fruits} + {#each fruits as fruit (fruit)} +
{fruit}
+ {/each} + {/if} +
\ No newline at end of file