@samitouri / QOS-React / commits / 8ce53671ed

Use the same value synchronization function on number blur (#11746)

I updated ReactDOMInput.synchronizeDefaultValue such that it assignes the defaultValue property instead of the value attribute. I never followed up on the ChangeEventPlugin's on blur behavior.

Nathan Hunzaker committed Dec 2, 2017 at 11:06 UTC 8ce53671eddc8e96a51d87c9b1ad8cd0532ff9d5
2 files changed +3 -5
packages/react-dom/src/client/ReactDOMFiberInput.js
+1 -1
@@ -307,7 +307,7 @@ function updateNamedCousins(rootNode, props) {
307 // when the user is inputting text
308 //
309 // https://github.com/facebook/react/issues/7253
310 -function synchronizeDefaultValue(
310 +export function synchronizeDefaultValue(
311 node: InputWithWrapperState,
312 type: ?string,
313 value: *,
packages/react-dom/src/events/ChangeEventPlugin.js
+2 -4
@@ -17,6 +17,7 @@ import getEventTarget from './getEventTarget';
17 import isEventSupported from './isEventSupported';
18 import {getNodeFromInstance} from '../client/ReactDOMComponentTree';
19 import * as inputValueTracking from '../client/inputValueTracking';
20 +import {synchronizeDefaultValue} from '../client/ReactDOMFiberInput';
21
22 var eventTypes = {
23 change: {
@@ -235,10 +236,7 @@ function handleControlledInputBlur(inst, node) {
236 }
237
238 // If controlled, assign the value attribute to the current value on blur
238 - let value = '' + node.value;
239 - if (node.getAttribute('value') !== value) {
240 - node.setAttribute('value', value);
241 - }
239 + synchronizeDefaultValue(node, 'number', node.value);
240 }
241
242 /**