diff --git a/src/compile/render-dom/wrappers/Slot.ts b/src/compile/render-dom/wrappers/Slot.ts index 31ca05b0df..8949a80803 100644 --- a/src/compile/render-dom/wrappers/Slot.ts +++ b/src/compile/render-dom/wrappers/Slot.ts @@ -141,7 +141,7 @@ export default class SlotWrapper extends Wrapper { if (this.dependencies.size > 1) update_conditions = `(${update_conditions})`; block.builders.update.addBlock(deindent` - if (${slot} && ${update_conditions}) { + if (${slot} && ${slot}.p && ${update_conditions}) { ${slot}.p(@get_slot_changes(${slot_definition}, ctx, changed, ${get_slot_changes}), @get_slot_context(${slot_definition}, ctx, ${get_slot_context})); } `); @@ -150,4 +150,4 @@ export default class SlotWrapper extends Wrapper { `if (${slot}) ${slot}.d(detach);` ); } -} \ No newline at end of file +} diff --git a/test/runtime/samples/component-slot-static-and-dynamic/Nested.svelte b/test/runtime/samples/component-slot-static-and-dynamic/Nested.svelte new file mode 100644 index 0000000000..bf28fb0bcc --- /dev/null +++ b/test/runtime/samples/component-slot-static-and-dynamic/Nested.svelte @@ -0,0 +1,4 @@ +
+ + +
diff --git a/test/runtime/samples/component-slot-static-and-dynamic/_config.js b/test/runtime/samples/component-slot-static-and-dynamic/_config.js new file mode 100644 index 0000000000..93ec069502 --- /dev/null +++ b/test/runtime/samples/component-slot-static-and-dynamic/_config.js @@ -0,0 +1,19 @@ +export default { + html: ` +
+ static + 0 +
+ `, + + test({ assert, component, target }) { + component.dynamic += 1; + + assert.htmlEqual(target.innerHTML, ` +
+ static + 1 +
+ `); + } +}; diff --git a/test/runtime/samples/component-slot-static-and-dynamic/main.svelte b/test/runtime/samples/component-slot-static-and-dynamic/main.svelte new file mode 100644 index 0000000000..2567da1b75 --- /dev/null +++ b/test/runtime/samples/component-slot-static-and-dynamic/main.svelte @@ -0,0 +1,11 @@ + + + + + static + {dynamic} +