@@ -467,16 +467,9 @@ function serialize_dynamic_element_attributes(attributes, context, element_id) {
467
467
* @param {import('estree').Identifier } node_id
468
468
* @param {import('#compiler').Attribute } attribute
469
469
* @param {import('../types.js').ComponentContext } context
470
- * @param {boolean } needs_isolation
471
470
* @returns {boolean }
472
471
*/
473
- function serialize_element_attribute_update_assignment (
474
- element ,
475
- node_id ,
476
- attribute ,
477
- context ,
478
- needs_isolation
479
- ) {
472
+ function serialize_element_attribute_update_assignment ( element , node_id , attribute , context ) {
480
473
const state = context . state ;
481
474
const name = get_attribute_name ( element , attribute , context ) ;
482
475
const is_svg = context . state . metadata . namespace === 'svg' ;
@@ -513,6 +506,10 @@ function serialize_element_attribute_update_assignment(
513
506
value
514
507
)
515
508
) ;
509
+ } else if ( name === 'value' ) {
510
+ update = b . stmt ( b . call ( '$.set_value' , node_id , value ) ) ;
511
+ } else if ( name === 'checked' ) {
512
+ update = b . stmt ( b . call ( '$.set_checked' , node_id , value ) ) ;
516
513
} else if ( DOMProperties . includes ( name ) ) {
517
514
update = b . stmt ( b . assignment ( '=' , b . member ( node_id , b . id ( name ) ) , value ) ) ;
518
515
} else {
@@ -521,7 +518,7 @@ function serialize_element_attribute_update_assignment(
521
518
}
522
519
523
520
if ( attribute . metadata . dynamic ) {
524
- if ( contains_call_expression || needs_isolation ) {
521
+ if ( contains_call_expression ) {
525
522
state . init . push ( serialize_update ( update ) ) ;
526
523
} else {
527
524
state . update . push ( update ) ;
@@ -2072,24 +2069,7 @@ export const template_visitors = {
2072
2069
const is =
2073
2070
is_custom_element && child_metadata . namespace !== 'foreign'
2074
2071
? serialize_custom_element_attribute_update_assignment ( node_id , attribute , context )
2075
- : serialize_element_attribute_update_assignment (
2076
- node ,
2077
- node_id ,
2078
- attribute ,
2079
- context ,
2080
- /**
2081
- * if the input needs input or content reset we also
2082
- * want to isolate the template effect or else every
2083
- * unrelated change will reset the value (and the user could)
2084
- * change the value outside of the reactivity
2085
- *
2086
- * <input value={val} />
2087
- *
2088
- * should only be updated when val changes and not when another
2089
- * unrelated variable changes.
2090
- * */
2091
- needs_content_reset || needs_input_reset
2092
- ) ;
2072
+ : serialize_element_attribute_update_assignment ( node , node_id , attribute , context ) ;
2093
2073
if ( is ) is_attributes_reactive = true ;
2094
2074
}
2095
2075
}
0 commit comments