File tree Expand file tree Collapse file tree 4 files changed +24
-11
lines changed
src/internal/client/dom/elements
tests/runtime-runes/samples/event-spread-timing Expand file tree Collapse file tree 4 files changed +24
-11
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' svelte ' : patch
3+ ---
4+
5+ fix: ensure spread attribute events are attached synchronously
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 set_active_effect ,
1414 set_active_reaction
1515} from '../../runtime.js' ;
16+ import { destroy_effect , effect } from '../../reactivity/effects.js' ;
1617
1718/**
1819 * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need
@@ -325,17 +326,10 @@ export function set_attributes(
325326 }
326327 }
327328
328- // On the first run, ensure that events are added after bindings so
329- // that their listeners fire after the binding listeners
330- if ( ! prev ) {
331- queue_micro_task ( ( ) => {
332- if ( ! element . isConnected ) return ;
333- for ( const [ key , value , evt ] of events ) {
334- if ( current [ key ] === value ) {
335- evt ( ) ;
336- }
337- }
338- } ) ;
329+ for ( const [ key , value , evt ] of events ) {
330+ if ( current [ key ] === value ) {
331+ evt ( ) ;
332+ }
339333 }
340334
341335 return current ;
Original file line number Diff line number Diff line change 1+ import { test } from '../../test' ;
2+
3+ export default test ( {
4+ test ( { assert, logs } ) {
5+ assert . deepEqual ( logs , [ 'onfocus' ] ) ;
6+ }
7+ } ) ;
Original file line number Diff line number Diff line change 1+ <script >
2+ const focus = (input ) => {
3+ input .focus ();
4+ };
5+ </script >
6+
7+ <input {...({})} onfocus ={() => console .log (" onfocus" )} use:focus />
You can’t perform that action at this time.
0 commit comments