@@ -296,7 +296,10 @@ export function RegularElement(node, context) {
296296 continue ;
297297 }
298298
299- if ( name === 'class' ) {
299+ if ( name === 'autofocus' ) {
300+ let { value } = build_attribute_value ( attribute . value , context ) ;
301+ context . state . init . push ( b . stmt ( b . call ( '$.autofocus' , node_id , value ) ) ) ;
302+ } else if ( name === 'class' ) {
300303 const is_html = context . state . metadata . namespace === 'html' && node . name !== 'svg' ;
301304 build_set_class ( node , node_id , attribute , class_directives , context , is_html ) ;
302305 } else if ( name === 'style' ) {
@@ -587,23 +590,10 @@ function build_element_attribute_update_assignment(
587590 const state = context . state ;
588591 const name = get_attribute_name ( element , attribute ) ;
589592
590- const is_autofocus = name === 'autofocus' ;
591-
592593 let { value, has_state } = build_attribute_value ( attribute . value , context , ( value , metadata ) =>
593- metadata . has_call
594- ? // if it's autofocus we will not add this to a template effect so we don't want to get the expression id
595- // but separately memoize the expression
596- is_autofocus
597- ? memoize_expression ( state , value )
598- : get_expression_id ( state , value )
599- : value
594+ metadata . has_call ? get_expression_id ( state , value ) : value
600595 ) ;
601596
602- if ( is_autofocus ) {
603- state . init . push ( b . stmt ( b . call ( '$.autofocus' , node_id , value ) ) ) ;
604- return ;
605- }
606-
607597 /** @type {Statement } */
608598 let update ;
609599
0 commit comments