Skip to content

Commit

Permalink
mount yield blocks immediately, if yield has a parent node (fixes #561)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed May 4, 2017
1 parent b557976 commit dd2e5e8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/generators/dom/visitors/YieldTag.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
export default function visitYieldTag ( generator, block, state ) {
block.builders.mount.addLine(
`${block.component}._yield && ${block.component}._yield.mount( ${state.parentNode || block.target}, null );`
const parentNode = state.parentNode || block.target;

( state.parentNode ? block.builders.create : block.builders.mount ).addLine(
`if ( ${block.component}._yield ) ${block.component}._yield.mount( ${parentNode}, null );`
);

block.builders.destroy.addLine(
`${block.component}._yield && ${block.component}._yield.destroy( detach );`
`if ( ${block.component}._yield ) ${block.component}._yield.destroy( detach );`
);
}

0 comments on commit dd2e5e8

Please sign in to comment.