Merge pull request #5213 from spicyj/gh-5187-f

Follow-ups to #5187
This commit is contained in:
Ben Alpert
2015-10-19 11:19:10 -07:00
4 changed files with 10 additions and 17 deletions

View File

@@ -107,6 +107,7 @@ var ReactDOMInput = {
inst._wrapperState = {
initialChecked: props.defaultChecked || false,
initialValue: defaultValue != null ? defaultValue : null,
listeners: null,
onChange: _handleChange.bind(inst),
};
},

View File

@@ -174,6 +174,7 @@ var ReactDOMSelect = {
inst._wrapperState = {
pendingUpdate: false,
initialValue: value != null ? value : props.defaultValue,
listeners: null,
onChange: _handleChange.bind(inst),
wasMultiple: Boolean(props.multiple),
};

View File

@@ -128,6 +128,7 @@ var ReactDOMTextarea = {
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue),
listeners: null,
onChange: _handleChange.bind(inst),
};
},

View File

@@ -570,29 +570,32 @@ ReactDOMComponent.Mixin = {
case 'form':
case 'video':
case 'audio':
this._setupTrapBubbledEventsLocal(transaction);
this._wrapperState = {
listeners: null,
};
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'button':
props = ReactDOMButton.getNativeProps(this, props, nativeParent);
break;
case 'input':
this._setupTrapBubbledEventsLocal(transaction);
ReactDOMInput.mountWrapper(this, props, nativeParent);
props = ReactDOMInput.getNativeProps(this, props);
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'option':
ReactDOMOption.mountWrapper(this, props, nativeParent);
props = ReactDOMOption.getNativeProps(this, props);
break;
case 'select':
this._setupTrapBubbledEventsLocal(transaction);
ReactDOMSelect.mountWrapper(this, props, nativeParent);
props = ReactDOMSelect.getNativeProps(this, props);
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'textarea':
this._setupTrapBubbledEventsLocal(transaction);
ReactDOMTextarea.mountWrapper(this, props, nativeParent);
props = ReactDOMTextarea.getNativeProps(this, props);
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
}
@@ -699,19 +702,6 @@ ReactDOMComponent.Mixin = {
return mountImage;
},
/**
* Setup this component to trap non-bubbling events locally
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
*/
_setupTrapBubbledEventsLocal: function(transaction) {
this._wrapperState = {
listeners: null,
};
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
},
/**
* Creates markup for the open tag and all attributes.
*