Skip to content

fix #1780 just start use parent instead parent.parent in IfBlock wrapper #1792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compile/render-dom/wrappers/IfBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
13 changes: 13 additions & 0 deletions test/runtime/samples/each-block-in-if-block/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
data: {
dummy: false,
fruits: ['Apple', 'Banana', 'Tomato'],
},

html: '<div><div>Apple</div><div>Banana</div><div>Tomato</div></div>',

test ( assert, component, target ) {
component.set({ dummy: true });
assert.htmlEqual(target.innerHTML, '<div><div>Apple</div><div>Banana</div><div>Tomato</div></div>' );
}
};
7 changes: 7 additions & 0 deletions test/runtime/samples/each-block-in-if-block/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div>
{#if fruits}
{#each fruits as fruit (fruit)}
<div>{fruit}</div>
{/each}
{/if}
</div>