-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle spreads within static strings (#9554)
Previously, if a part of the template was determined be be optimizable using innerHTML, it would error if there's a spread on an attribute
- Loading branch information
1 parent
1fd0b18
commit 9b33413
Showing
6 changed files
with
79 additions
and
3 deletions.
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': patch | ||
--- | ||
|
||
fix: handle spreads within static strings |
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
11 changes: 11 additions & 0 deletions
11
packages/svelte/test/runtime/samples/spread-from-import/_config.js
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,11 @@ | ||
export default { | ||
html: ` | ||
<div> | ||
<p class="tooltip">static stuff</p> | ||
</div> | ||
<div> | ||
<p class="tooltip">dynamic stuff</p> | ||
</div> | ||
<button>unused</button> | ||
` | ||
}; |
14 changes: 14 additions & 0 deletions
14
packages/svelte/test/runtime/samples/spread-from-import/main.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 { spread } from './spread.js'; | ||
let dynamic = 'dynamic'; | ||
</script> | ||
|
||
<div> | ||
<p {...spread()}>static stuff</p> | ||
</div> | ||
|
||
<div> | ||
<p {...spread()}>{dynamic} stuff</p> | ||
</div> | ||
|
||
<button on:click={() => dynamic = ''}>unused</button> |
6 changes: 6 additions & 0 deletions
6
packages/svelte/test/runtime/samples/spread-from-import/spread.js
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,6 @@ | ||
export function spread() { | ||
return { | ||
class: 'tooltip', | ||
id: null | ||
}; | ||
} |