only create fallback content if no slot is provided - fixes #2354

pull/2409/head
Richard Harris 6 years ago
parent 079a1ba276
commit aa653558d0

@ -106,6 +106,7 @@ export default class SlotWrapper extends Wrapper {
let mount_before = block.builders.mount.toString();
block.builders.create.push_condition(`!${slot}`);
block.builders.claim.push_condition(`!${slot}`);
block.builders.hydrate.push_condition(`!${slot}`);
block.builders.mount.push_condition(`!${slot}`);
block.builders.update.push_condition(`!${slot}`);
@ -118,6 +119,7 @@ export default class SlotWrapper extends Wrapper {
block.event_listeners = listeners;
block.builders.create.pop_condition();
block.builders.claim.pop_condition();
block.builders.hydrate.pop_condition();
block.builders.mount.pop_condition();
block.builders.update.pop_condition();

@ -0,0 +1,7 @@
<div>
<slot name="foo">
foo fallback
</slot>
<slot></slot>
</div>

@ -0,0 +1,4 @@
<div>
<div slot="foo">foo override</div>
default
</div>

@ -0,0 +1,4 @@
<div>
<div slot="foo">foo override</div>
default
</div>

@ -0,0 +1,11 @@
<script>
import Nested from './Nested.svelte'
</script>
<Nested>
<div slot="foo">
foo override
</div>
default
</Nested>
Loading…
Cancel
Save