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.
This commit is contained in:
Nathan Hunzaker
2017-12-02 11:06:32 -05:00
committed by Dan Abramov
parent 31ea0aa6d7
commit 8ce53671ed
2 changed files with 3 additions and 5 deletions

View File

@@ -307,7 +307,7 @@ function updateNamedCousins(rootNode, props) {
// when the user is inputting text
//
// https://github.com/facebook/react/issues/7253
function synchronizeDefaultValue(
export function synchronizeDefaultValue(
node: InputWithWrapperState,
type: ?string,
value: *,

View File

@@ -17,6 +17,7 @@ import getEventTarget from './getEventTarget';
import isEventSupported from './isEventSupported';
import {getNodeFromInstance} from '../client/ReactDOMComponentTree';
import * as inputValueTracking from '../client/inputValueTracking';
import {synchronizeDefaultValue} from '../client/ReactDOMFiberInput';
var eventTypes = {
change: {
@@ -235,10 +236,7 @@ function handleControlledInputBlur(inst, node) {
}
// If controlled, assign the value attribute to the current value on blur
let value = '' + node.value;
if (node.getAttribute('value') !== value) {
node.setAttribute('value', value);
}
synchronizeDefaultValue(node, 'number', node.value);
}
/**