File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed
src/compiler/phases/2-analyze
tests/runtime-runes/samples/dynamic-style-attr Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' svelte ' : patch
3+ ---
4+
5+ fix: ensure dynamic attributes containing call expressions update
Original file line number Diff line number Diff line change @@ -762,7 +762,7 @@ const common_visitors = {
762762 return false ;
763763 }
764764
765- return chunk . metadata . dynamic ;
765+ return chunk . metadata . dynamic || chunk . metadata . contains_call_expression ;
766766 } ) ;
767767
768768 if ( is_event_attribute ( node ) ) {
Original file line number Diff line number Diff line change 1+ import { test } from '../../test' ;
2+ import { flushSync } from 'svelte' ;
3+
4+ export default test ( {
5+ html : `<div style="background-color: red">Hello world</div><button>Make blue</button` ,
6+
7+ async test ( { assert, target, component } ) {
8+ const [ b1 ] = target . querySelectorAll ( 'button' ) ;
9+ flushSync ( ( ) => {
10+ b1 . click ( ) ;
11+ } ) ;
12+ assert . htmlEqual (
13+ target . innerHTML ,
14+ `<div style="background-color: blue">Hello world</div><button>Make blue</button`
15+ ) ;
16+ }
17+ } ) ;
Original file line number Diff line number Diff line change 1+ <script >
2+ let color = $state (' red' );
3+
4+ const getColor = () => color;
5+ </script >
6+
7+ <div style ="background-color: {getColor ()}" >Hello world</div >
8+
9+ <button onclick ={() => color = ' blue' }>Make blue</button >
You can’t perform that action at this time.
0 commit comments