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 @@ + + +