From 11d86981843d3275293ff093fb36fde20fb486d4 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 25 Apr 2017 16:57:59 -0400 Subject: [PATCH] fix for #524 --- src/generators/dom/preprocess.js | 2 +- .../samples/component-yield-follows-element/Foo.html | 2 ++ .../component-yield-follows-element/_config.js | 6 ++++++ .../samples/component-yield-follows-element/main.html | 11 +++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/component-yield-follows-element/Foo.html create mode 100644 test/runtime/samples/component-yield-follows-element/_config.js create mode 100644 test/runtime/samples/component-yield-follows-element/main.html diff --git a/src/generators/dom/preprocess.js b/src/generators/dom/preprocess.js index 8661dbb0fb85..6e6c33eafffc 100644 --- a/src/generators/dom/preprocess.js +++ b/src/generators/dom/preprocess.js @@ -264,7 +264,7 @@ function preprocessChildren ( generator, block, state, node, isTopLevel ) { if ( lastChild ) { lastChild.next = child; - lastChild.needsAnchor = !child._state.name; + lastChild.needsAnchor = !child._state || !child._state.name; } lastChild = child; diff --git a/test/runtime/samples/component-yield-follows-element/Foo.html b/test/runtime/samples/component-yield-follows-element/Foo.html new file mode 100644 index 000000000000..1e619f2ecdb0 --- /dev/null +++ b/test/runtime/samples/component-yield-follows-element/Foo.html @@ -0,0 +1,2 @@ +
before
+{{yield}} \ No newline at end of file diff --git a/test/runtime/samples/component-yield-follows-element/_config.js b/test/runtime/samples/component-yield-follows-element/_config.js new file mode 100644 index 000000000000..93703c7dab79 --- /dev/null +++ b/test/runtime/samples/component-yield-follows-element/_config.js @@ -0,0 +1,6 @@ +export default { + html: ` +
before
+ test + ` +}; diff --git a/test/runtime/samples/component-yield-follows-element/main.html b/test/runtime/samples/component-yield-follows-element/main.html new file mode 100644 index 000000000000..15747d9d53ab --- /dev/null +++ b/test/runtime/samples/component-yield-follows-element/main.html @@ -0,0 +1,11 @@ +test + +