mirror of https://github.com/sveltejs/svelte
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 attributepull/9555/head
parent
1fd0b18459
commit
9b3341378a
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: handle spreads within static strings
|
@ -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>
|
||||
`
|
||||
};
|
@ -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>
|
@ -0,0 +1,6 @@
|
||||
export function spread() {
|
||||
return {
|
||||
class: 'tooltip',
|
||||
id: null
|
||||
};
|
||||
}
|
Loading…
Reference in new issue