diff --git a/src/compile/render-dom/wrappers/Element/index.ts b/src/compile/render-dom/wrappers/Element/index.ts index 4a30232fcc..fea7737671 100644 --- a/src/compile/render-dom/wrappers/Element/index.ts +++ b/src/compile/render-dom/wrappers/Element/index.ts @@ -203,6 +203,10 @@ export default class ElementWrapper extends Wrapper { if (this.slot_block) { block.parent.addDependencies(block.dependencies); + + // appalling hack + block.wrappers.splice(block.wrappers.indexOf(this), 1); + this.slot_block.wrappers.push(this); } } @@ -216,13 +220,13 @@ export default class ElementWrapper extends Wrapper { if (this.node.name === 'noscript') return; - const node = this.var; - const nodes = parentNodes && block.getUniqueName(`${this.var}_nodes`) // if we're in unclaimable territory, i.e. , parentNodes is null - if (this.slot_block) { block = this.slot_block; } + const node = this.var; + const nodes = parentNodes && block.getUniqueName(`${this.var}_nodes`) // if we're in unclaimable territory, i.e. , parentNodes is null + block.addVariable(node); const renderStatement = this.getRenderStatement(); block.builders.create.addLine( diff --git a/test/runtime/samples/component-slot-nested-in-element/One.svelte b/test/runtime/samples/component-slot-nested-in-element/One.svelte new file mode 100644 index 0000000000..ec1e06a598 --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-element/One.svelte @@ -0,0 +1,11 @@ + + + +
+
+ +
+
+
\ No newline at end of file diff --git a/test/runtime/samples/component-slot-nested-in-element/Two.svelte b/test/runtime/samples/component-slot-nested-in-element/Two.svelte new file mode 100644 index 0000000000..e3842479c5 --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-element/Two.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-nested-in-element/_config.js b/test/runtime/samples/component-slot-nested-in-element/_config.js new file mode 100644 index 0000000000..bbdd8793c7 --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-element/_config.js @@ -0,0 +1,9 @@ +export default { + html: ` +
+
+
a
+
+
+ ` +}; diff --git a/test/runtime/samples/component-slot-nested-in-element/main.svelte b/test/runtime/samples/component-slot-nested-in-element/main.svelte new file mode 100644 index 0000000000..32f5ddc312 --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-element/main.svelte @@ -0,0 +1,7 @@ + + + +
a
+
\ No newline at end of file