diff --git a/src/compile/render-dom/wrappers/Element/index.ts b/src/compile/render-dom/wrappers/Element/index.ts index b08c438002..78a50d36ac 100644 --- a/src/compile/render-dom/wrappers/Element/index.ts +++ b/src/compile/render-dom/wrappers/Element/index.ts @@ -132,7 +132,7 @@ export default class ElementWrapper extends Wrapper { const name = attribute.getStaticValue(); if (!(owner as InlineComponentWrapper).slots.has(name)) { - const child_block = block.parent.child({ + const child_block = block.child({ comment: createDebuggingComment(node, this.renderer.component), name: this.renderer.component.getUniqueName(`create_${sanitize(name)}_slot`) }); @@ -205,7 +205,8 @@ export default class ElementWrapper extends Wrapper { block.parent.addDependencies(block.dependencies); // appalling hack - block.parent.wrappers.splice(block.parent.wrappers.indexOf(this), 1); + const index = block.parent.wrappers.indexOf(this); + block.parent.wrappers.splice(index, 1); block.wrappers.push(this); } } diff --git a/test/runtime/samples/component-slot-named-c/Nested.svelte b/test/runtime/samples/component-slot-named-c/Nested.svelte new file mode 100644 index 0000000000..a94392ce5d --- /dev/null +++ b/test/runtime/samples/component-slot-named-c/Nested.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-named-c/_config.js b/test/runtime/samples/component-slot-named-c/_config.js new file mode 100644 index 0000000000..adfd944e26 --- /dev/null +++ b/test/runtime/samples/component-slot-named-c/_config.js @@ -0,0 +1,6 @@ +export default { + html: ` + Hello + world + ` +}; diff --git a/test/runtime/samples/component-slot-named-c/main.svelte b/test/runtime/samples/component-slot-named-c/main.svelte new file mode 100644 index 0000000000..86ae062850 --- /dev/null +++ b/test/runtime/samples/component-slot-named-c/main.svelte @@ -0,0 +1,11 @@ + + + + Hello + + + + world + \ No newline at end of file