diff --git a/src/renderers/dom/client/wrappers/ReactDOMInput.js b/src/renderers/dom/client/wrappers/ReactDOMInput.js index b20092a27fb5b..be7eb3628d01f 100644 --- a/src/renderers/dom/client/wrappers/ReactDOMInput.js +++ b/src/renderers/dom/client/wrappers/ReactDOMInput.js @@ -178,17 +178,6 @@ var ReactDOMInput = { } }, - postMountWrapper: function(inst) { - var node = ReactDOMComponentTree.getNodeFromInstance(inst); - var props = inst._currentElement.props; - - // Values derived from markup, like setting innerHTML or working - // from server-rendered markup, will not have value assigned as a - // property. It needs to be directly assigned to detatch it from - // default value. - node.value = node.value; - }, - // Ensure that there is no disconnect between an input's property // value and component state. This should run during `onChange`. enforceControlledInputValue: function(inst) { diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js index cda602d053372..78336374818c1 100644 --- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js +++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js @@ -855,7 +855,6 @@ describe('ReactDOMInput', function() { 'set min', 'set max', 'set value', - 'set value' // second time is post mount ]); }); diff --git a/src/renderers/dom/shared/HTMLDOMPropertyConfig.js b/src/renderers/dom/shared/HTMLDOMPropertyConfig.js index b0d9ab037a11a..e045822605f8b 100644 --- a/src/renderers/dom/shared/HTMLDOMPropertyConfig.js +++ b/src/renderers/dom/shared/HTMLDOMPropertyConfig.js @@ -41,7 +41,6 @@ var HTMLDOMPropertyConfig = { 'max', 'value', 'checked', - 'defaultChecked', ], }, @@ -246,6 +245,19 @@ var HTMLDOMPropertyConfig = { } }, + defaultValue: function(node, next) { + // If a value is present, intentially re-assign it to detatch it + // from defaultValue. Values derived from server-rendered markup + // will not had a prior changes to assign value as a property. + // + // Make an exception for multi-selects + if (!node.multiple && node.value !== '') { + node.value = node.value; + } + + node.defaultValue = next; + }, + // Chrome ~50 does not properly detatch defaultChecked, this mutation method // is a work around to mitigate a bug where setting defaultChecked changes // the value of checked, even after detachment: diff --git a/src/renderers/dom/shared/ReactDOMComponent.js b/src/renderers/dom/shared/ReactDOMComponent.js index 2677eaeb317ee..a0bf6a854ee12 100644 --- a/src/renderers/dom/shared/ReactDOMComponent.js +++ b/src/renderers/dom/shared/ReactDOMComponent.js @@ -239,11 +239,6 @@ function putListener() { ); } -function inputPostMount() { - var inst = this; - ReactDOMInput.postMountWrapper(inst); -} - function textareaPostMount() { var inst = this; ReactDOMTextarea.postMountWrapper(inst); @@ -660,10 +655,6 @@ ReactDOMComponent.Mixin = { switch (this._tag) { case 'input': - transaction.getReactMountReady().enqueue( - inputPostMount, - this - ); if (props.autoFocus) { transaction.getReactMountReady().enqueue( AutoFocusUtils.focusDOMComponent,