diff --git a/src/compiler/compile/nodes/InlineComponent.ts b/src/compiler/compile/nodes/InlineComponent.ts index a7bc986e9b..3d9a8ab0db 100644 --- a/src/compiler/compile/nodes/InlineComponent.ts +++ b/src/compiler/compile/nodes/InlineComponent.ts @@ -106,7 +106,7 @@ export default class InlineComponent extends Node { if (child.type === 'SlotTemplate') { children.push(child); info.children.splice(i, 1); - } else if ((child.type === 'Element' || child.type === 'InlineComponent' || child.type === 'Slot') && child.attributes.find(attribute => attribute.name === 'slot')) { + } else if ((child.type === 'Element' || child.type === 'DynamicElement' || child.type === 'InlineComponent' || child.type === 'Slot') && child.attributes.find(attribute => attribute.name === 'slot')) { const slot_template = { start: child.start, end: child.end, @@ -126,17 +126,17 @@ export default class InlineComponent extends Node { slot_template.attributes.push(attribute); } } - + children.push(slot_template); info.children.splice(i, 1); } } if (info.children.some(node => not_whitespace_text(node))) { - children.push({ + children.push({ start: info.start, end: info.end, - type: 'SlotTemplate', + type: 'SlotTemplate', name: 'svelte:fragment', attributes: [], children: info.children diff --git a/test/runtime/samples/dynamic-element-slot/Foo.svelte b/test/runtime/samples/dynamic-element-slot/Foo.svelte new file mode 100644 index 0000000000..51dda4b7e3 --- /dev/null +++ b/test/runtime/samples/dynamic-element-slot/Foo.svelte @@ -0,0 +1,7 @@ +