@@ -391,32 +391,31 @@ class Morph {
391391 }
392392
393393 #visitAttributes( from : Element , to : Element ) : void {
394- const wasDirty = from . hasAttribute ( "morphlex-dirty" )
395- if ( wasDirty ) {
394+ if ( from . hasAttribute ( "morphlex-dirty" ) ) {
396395 from . removeAttribute ( "morphlex-dirty" )
397396 }
398397
399398 // First pass: update/add attributes from reference (iterate forwards)
400399 for ( const { name, value } of to . attributes ) {
401400 if ( name === "value" ) {
402401 if ( isInputElement ( from ) && from . value !== value ) {
403- if ( from !== this . #skipValuePropertyUpdateFor && ( ! this . #options. preserveChanges || ! wasDirty ) ) {
402+ if ( from !== this . #skipValuePropertyUpdateFor && ! this . #options. preserveChanges ) {
404403 from . value = value
405404 }
406405 }
407406 }
408407
409408 if ( name === "selected" ) {
410409 if ( isOptionElement ( from ) && ! from . selected ) {
411- if ( ! this . #options. preserveChanges || ! wasDirty ) {
410+ if ( ! this . #options. preserveChanges ) {
412411 from . selected = true
413412 }
414413 }
415414 }
416415
417416 if ( name === "checked" ) {
418417 if ( isInputElement ( from ) && ! from . checked ) {
419- if ( ! this . #options. preserveChanges || ! wasDirty ) {
418+ if ( ! this . #options. preserveChanges ) {
420419 from . checked = true
421420 }
422421 }
@@ -435,15 +434,15 @@ class Morph {
435434 if ( ! to . hasAttribute ( name ) ) {
436435 if ( name === "selected" ) {
437436 if ( isOptionElement ( from ) && from . selected ) {
438- if ( ! this . #options. preserveChanges || ! wasDirty ) {
437+ if ( ! this . #options. preserveChanges ) {
439438 from . selected = false
440439 }
441440 }
442441 }
443442
444443 if ( name === "checked" ) {
445444 if ( isInputElement ( from ) && from . checked ) {
446- if ( ! this . #options. preserveChanges || ! wasDirty ) {
445+ if ( ! this . #options. preserveChanges ) {
447446 from . checked = false
448447 }
449448 }
0 commit comments