-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not duplicated variable names when multiple `svelte:component…
…` exist (#121)
- Loading branch information
1 parent
9dfd5e1
commit 452be37
Showing
6 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte-preprocess-delegate-events': patch | ||
--- | ||
|
||
fix: do not duplicated variable names when multiple svelte:component exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
let button1; | ||
let button2; | ||
</script> | ||
|
||
<button on:* bind:this={button1}>Click Me</button> | ||
<button on:* bind:this={button2}>Click Me</button> |
14 changes: 14 additions & 0 deletions
14
test/fixture/element-multi-element-with-this/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
import { registerDelegatedEvents } from 'svelte-preprocess-delegate-events/runtime'; | ||
import { get_current_component } from 'svelte/internal'; | ||
let button1; | ||
let button2; | ||
const component0 = get_current_component(); | ||
$: registerDelegatedEvents(button1, component0, (handler) => handler, {}); | ||
$: registerDelegatedEvents(button2, component0, (handler) => handler, {}); | ||
</script> | ||
|
||
<button bind:this={button1}>Click Me</button> | ||
<button bind:this={button2}>Click Me</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script lang="ts"> | ||
import Component from './Component.svelte'; | ||
import Component2 from './Component2.svelte'; | ||
const a = false; | ||
</script> | ||
|
||
{#if a} | ||
<svelte:component this={Component} on:* /> | ||
{:else} | ||
<svelte:component this={Component2} on:* /> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script lang="ts"> | ||
import { get_current_component } from 'svelte/internal'; | ||
import { boundComponents } from 'svelte-preprocess-delegate-events/runtime'; | ||
import { proxyCallbacks } from 'svelte-preprocess-delegate-events/runtime'; | ||
import Component from './Component.svelte'; | ||
import Component2 from './Component2.svelte'; | ||
const a = false; | ||
const svelte_component0 = boundComponents(); | ||
const component0 = get_current_component(); | ||
$: proxyCallbacks(component0, svelte_component0.bounds, false); | ||
const svelte_component1 = boundComponents(); | ||
$: proxyCallbacks(component0, svelte_component1.bounds, false); | ||
</script> | ||
|
||
{#if a} | ||
<svelte:component this={Component} bind:this={svelte_component0.bounds} /> | ||
{:else} | ||
<svelte:component this={Component2} bind:this={svelte_component1.bounds} /> | ||
{/if} |