@@ -32,13 +32,12 @@ function valueInterceptor(
3232 if ( isUI ) {
3333 this [ UIValue ] = String ( v )
3434 setPreviousValue ( this , String ( this . value ) )
35- } else {
36- trackOrSetValue ( this , String ( v ) )
3735 }
3836
3937 return {
4038 applyNative : ! ! isUI ,
4139 realArgs : sanitizeValue ( this , v ) ,
40+ then : isUI ? undefined : ( ) => trackOrSetValue ( this , String ( v ) ) ,
4241 }
4342}
4443
@@ -66,6 +65,10 @@ export function setUIValue(
6665 element : HTMLInputElement | HTMLTextAreaElement ,
6766 value : string ,
6867) {
68+ if ( element [ InitialValue ] === undefined ) {
69+ element [ InitialValue ] = element . value
70+ }
71+
6972 element . value = {
7073 [ UIValue ] : UIValue ,
7174 toString : ( ) => value ,
@@ -78,10 +81,10 @@ export function getUIValue(element: HTMLInputElement | HTMLTextAreaElement) {
7881 : String ( element [ UIValue ] )
7982}
8083
81- export function setInitialValue (
84+ export function clearInitialValue (
8285 element : HTMLInputElement | HTMLTextAreaElement ,
8386) {
84- element [ InitialValue ] = element . value
87+ element [ InitialValue ] = undefined
8588}
8689
8790export function getInitialValue (
@@ -123,7 +126,6 @@ function setCleanValue(
123126 v : string ,
124127) {
125128 element [ UIValue ] = undefined
126- element [ InitialValue ] = v
127129
128130 // Programmatically setting the value property
129131 // moves the cursor to the end of the input.
0 commit comments