diff --git a/src/generators/dom/visitors/YieldTag.js b/src/generators/dom/visitors/YieldTag.js index aa95cd284e07..81dcb3ad5314 100644 --- a/src/generators/dom/visitors/YieldTag.js +++ b/src/generators/dom/visitors/YieldTag.js @@ -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 );` ); } \ No newline at end of file