mirror of https://github.com/sveltejs/svelte
fix: support dynamic attributes containing call expressions (#9443)
Fixes #9403. We weren't taking into account the containment of call expressions logic before.pull/9446/head
parent
a6fdc47a0b
commit
da37c928ef
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure dynamic attributes containing call expressions update
|
@ -0,0 +1,17 @@
|
||||
import { test } from '../../test';
|
||||
import { flushSync } from 'svelte';
|
||||
|
||||
export default test({
|
||||
html: `<div style="background-color: red">Hello world</div><button>Make blue</button`,
|
||||
|
||||
async test({ assert, target, component }) {
|
||||
const [b1] = target.querySelectorAll('button');
|
||||
flushSync(() => {
|
||||
b1.click();
|
||||
});
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`<div style="background-color: blue">Hello world</div><button>Make blue</button`
|
||||
);
|
||||
}
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
let color = $state('red');
|
||||
|
||||
const getColor = () => color;
|
||||
</script>
|
||||
|
||||
<div style="background-color: {getColor()}">Hello world</div>
|
||||
|
||||
<button onclick={() => color = 'blue'}>Make blue</button>
|
Loading…
Reference in new issue