dillon1000/react
Commit
Browse files Inputs should not mutate value on type conversion (#9806)
This is a follow-up on
https://github.com/facebook/react/pull/9584#discussion_r115642293. There
is no need to assign the value property of an input if the value
property of the React component changes types, but stringifies to the
same value. For example:
```javascript
DOM.render(<input value="true" />, el)
DOM.render(<input value={true} />, el)
```
In this case, the assignment to `input.value` will always be
cast to the string "true". There is no need to perform this
assignment. Particularly when we already cast the value to a string
later:
```javascript
// 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;
```Changed paths4 files
First-parent comparisonscripts/fiber/tests-passing.txt ModifiedM src/renderers/dom/fiber/wrappers/ReactDOMFiberInput.js ModifiedM src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js ModifiedM src/renderers/dom/stack/client/wrappers/ReactDOMInput.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…