From 0d797ea8aeba954d12a3921327d2c46c9d6be3c5 Mon Sep 17 00:00:00 2001 From: Yury Zhuravlev Date: Fri, 19 Oct 2018 12:41:25 +0900 Subject: [PATCH] Fix removing next link during strip whitespaces for first element. --- src/compile/render-dom/wrappers/Fragment.ts | 4 ---- test/runtime/samples/if-block-first/_config.js | 12 ++++++++++++ test/runtime/samples/if-block-first/main.html | 6 ++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 test/runtime/samples/if-block-first/_config.js create mode 100644 test/runtime/samples/if-block-first/main.html diff --git a/src/compile/render-dom/wrappers/Fragment.ts b/src/compile/render-dom/wrappers/Fragment.ts index 20c200fe58..066daa2720 100644 --- a/src/compile/render-dom/wrappers/Fragment.ts +++ b/src/compile/render-dom/wrappers/Fragment.ts @@ -120,10 +120,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 0000000000..e7020cbf8c --- /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 0000000000..bae6f01e10 --- /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