Skip to content

Commit

Permalink
Follow-ups to facebook#5187
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiebits committed Oct 19, 2015
1 parent 8f1ce99 commit 545f317
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/renderers/dom/client/wrappers/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ var ReactDOMInput = {
inst._wrapperState = {
initialChecked: props.defaultChecked || false,
initialValue: defaultValue != null ? defaultValue : null,
listeners: null,
onChange: _handleChange.bind(inst),
};
},
Expand Down
1 change: 1 addition & 0 deletions src/renderers/dom/client/wrappers/ReactDOMSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
Expand Down
1 change: 1 addition & 0 deletions src/renderers/dom/client/wrappers/ReactDOMTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
},
Expand Down
24 changes: 7 additions & 17 deletions src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 545f317

Please sign in to comment.