mirror of https://github.com/sveltejs/svelte
fix: avoid migrating slots in custom elements (#13406)
They'll be preserved as-is in some future Svelte versionpull/13394/head
parent
30c438c279
commit
d4230049da
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: avoid migrating slots in custom elements
|
@ -0,0 +1,23 @@
|
||||
<svelte:options customElement="my-element" />
|
||||
|
||||
<script>
|
||||
// to show that it doesn't bail out from the whole migration
|
||||
let count = 0;
|
||||
</script>
|
||||
|
||||
<button on:click={()=>count++}><slot /></button>
|
||||
|
||||
{count}
|
||||
|
||||
{#if foo}
|
||||
<slot name="foo" {foo} />
|
||||
{/if}
|
||||
|
||||
{#if $$slots.bar}
|
||||
{$$slots}
|
||||
<slot name="bar" />
|
||||
{/if}
|
||||
|
||||
{#if $$slots.default}foo{/if}
|
||||
|
||||
<slot name="dashed-name" />
|
@ -0,0 +1,23 @@
|
||||
<svelte:options customElement="my-element" />
|
||||
|
||||
<script>
|
||||
// to show that it doesn't bail out from the whole migration
|
||||
let count = $state(0);
|
||||
</script>
|
||||
|
||||
<button onclick={()=>count++}><slot /></button>
|
||||
|
||||
{count}
|
||||
|
||||
{#if foo}
|
||||
<slot name="foo" {foo} />
|
||||
{/if}
|
||||
|
||||
{#if bar}
|
||||
{$$slots}
|
||||
<slot name="bar" />
|
||||
{/if}
|
||||
|
||||
{#if children}foo{/if}
|
||||
|
||||
<slot name="dashed-name" />
|
Loading…
Reference in new issue