diff --git a/src/compile/render-dom/wrappers/Fragment.ts b/src/compile/render-dom/wrappers/Fragment.ts index 20c200fe5835..2e4bb633e7ed 100644 --- a/src/compile/render-dom/wrappers/Fragment.ts +++ b/src/compile/render-dom/wrappers/Fragment.ts @@ -99,9 +99,7 @@ export default class FragmentWrapper { this.nodes.unshift(wrapper); link(lastChild, lastChild = wrapper); - } - - else { + } else { const Wrapper = wrappers[child.type]; if (!Wrapper) continue; @@ -120,10 +118,6 @@ export default class FragmentWrapper { if (!first.data) { first.var = null; this.nodes.shift(); - - if (this.nodes.length) { - link(null, this.nodes[0]); - } } } } diff --git a/test/runtime/samples/if-block-first/_config.js b/test/runtime/samples/if-block-first/_config.js new file mode 100644 index 000000000000..e7020cbf8c94 --- /dev/null +++ b/test/runtime/samples/if-block-first/_config.js @@ -0,0 +1,12 @@ +export default { + data: { + visible: false + }, + + html: '
before me
', + + test ( assert, component, target ) { + component.set({ visible: true }); + assert.htmlEqual(target.innerHTML, '
i am visible
before me
' ); + } +}; diff --git a/test/runtime/samples/if-block-first/main.html b/test/runtime/samples/if-block-first/main.html new file mode 100644 index 000000000000..bae6f01e104f --- /dev/null +++ b/test/runtime/samples/if-block-first/main.html @@ -0,0 +1,6 @@ +
+ {#if visible} +
i am visible
+ {/if} +
before me
+
\ No newline at end of file