Skip to content

Commit

Permalink
Remove loose check on non-number controlled inputs. Fix trailing dot …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
nhunzaker authored and flarnie committed May 3, 2017
1 parent 115452f commit e29871e
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 311 deletions.
70 changes: 0 additions & 70 deletions fixtures/dom/src/components/Header.js

This file was deleted.

34 changes: 0 additions & 34 deletions fixtures/dom/src/components/fixtures/index.js

This file was deleted.

This file was deleted.

167 changes: 0 additions & 167 deletions fixtures/dom/src/components/fixtures/number-inputs/index.js

This file was deleted.

3 changes: 1 addition & 2 deletions src/renderers/dom/client/wrappers/ReactDOMInput.js
Expand Up @@ -226,8 +226,7 @@ var ReactDOMInput = {
// browsers typically do this as necessary, jsdom doesn't.
node.value = '' + value;
}
// eslint-disable-next-line
} else if (value != node.value) {
} else if (node.value !== value) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
node.value = '' + value;
Expand Down

0 comments on commit e29871e

Please sign in to comment.