Skip to content

Commit e29871e

Browse files
nhunzakerflarnie
authored andcommitted
Remove loose check on non-number controlled inputs. Fix trailing dot issue. (#9584)
* Remove loose check when assigning non-number inputs This commit removes a check I added when working on number input issues where we perform a loose check on an input's value before we assign it. This prevented controlled text inputs from disallowing numeric text entry. I also added a DOM fixture text case. Related issues: #9561 (comment) * Use strict equality as a guard before assigning input.value This commit adds back the guard around assigning the value property to an input, however it does it using a strict equals. This prevents validated inputs, like emails and urls from losing the cursor position. It also adds associated test fixtures. * Add copy command after build for interup with surge.sh
1 parent 115452f commit e29871e

File tree

6 files changed

+192
-311
lines changed

6 files changed

+192
-311
lines changed

fixtures/dom/src/components/Header.js

-70
This file was deleted.

fixtures/dom/src/components/fixtures/index.js

-34
This file was deleted.

fixtures/dom/src/components/fixtures/number-inputs/NumberTestCase.js

-37
This file was deleted.

fixtures/dom/src/components/fixtures/number-inputs/index.js

-167
This file was deleted.

src/renderers/dom/client/wrappers/ReactDOMInput.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ var ReactDOMInput = {
226226
// browsers typically do this as necessary, jsdom doesn't.
227227
node.value = '' + value;
228228
}
229-
// eslint-disable-next-line
230-
} else if (value != node.value) {
229+
} else if (node.value !== value) {
231230
// Cast `value` to a string to ensure the value is set correctly. While
232231
// browsers typically do this as necessary, jsdom doesn't.
233232
node.value = '' + value;

0 commit comments

Comments
 (0)