mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-30 08:56:14 +01:00
fix slot block lineage - fixes #2124
This commit is contained in:
parent
c494c05ebf
commit
24e09efec1
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<slot name="name"></slot>
|
6
test/runtime/samples/component-slot-named-c/_config.js
Normal file
6
test/runtime/samples/component-slot-named-c/_config.js
Normal file
@ -0,0 +1,6 @@
|
||||
export default {
|
||||
html: `
|
||||
<span slot="name">Hello</span>
|
||||
<span slot="name">world</span>
|
||||
`
|
||||
};
|
11
test/runtime/samples/component-slot-named-c/main.svelte
Normal file
11
test/runtime/samples/component-slot-named-c/main.svelte
Normal file
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
import Nested from './Nested.svelte';
|
||||
</script>
|
||||
|
||||
<Nested>
|
||||
<span slot="name">Hello</span>
|
||||
</Nested>
|
||||
|
||||
<Nested>
|
||||
<span slot="name">world</span>
|
||||
</Nested>
|
Loading…
Reference in New Issue
Block a user