Make getChecked, getValue, handleChange private
Test Plan: grunt test, enter text in ballmer-peak example without any JS errors.
This commit is contained in:
parent
1f8ef4c903
commit
898621d0a1
|
@ -57,22 +57,16 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
|
||||||
return !this._isChanging;
|
return !this._isChanging;
|
||||||
},
|
},
|
||||||
|
|
||||||
getChecked: function() {
|
|
||||||
return this.props.checked != null ? this.props.checked : this.state.checked;
|
|
||||||
},
|
|
||||||
|
|
||||||
getValue: function() {
|
|
||||||
// Cast `this.props.value` to a string so equality checks pass.
|
|
||||||
return this.props.value != null ? '' + this.props.value : this.state.value;
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
// Clone `this.props` so we don't mutate the input.
|
// Clone `this.props` so we don't mutate the input.
|
||||||
var props = merge(this.props);
|
var props = merge(this.props);
|
||||||
|
|
||||||
props.checked = this.getChecked();
|
props.checked =
|
||||||
props.value = this.getValue();
|
this.props.checked != null ? this.props.checked : this.state.checked;
|
||||||
props.onChange = this.handleChange;
|
// Cast `this.props.value` to a string so equality checks pass.
|
||||||
|
props.value =
|
||||||
|
this.props.value != null ? '' + this.props.value : this.state.value;
|
||||||
|
props.onChange = this._handleChange;
|
||||||
|
|
||||||
return input(props, this.props.children);
|
return input(props, this.props.children);
|
||||||
},
|
},
|
||||||
|
@ -96,7 +90,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleChange: function(event) {
|
_handleChange: function(event) {
|
||||||
var returnValue;
|
var returnValue;
|
||||||
if (this.props.onChange) {
|
if (this.props.onChange) {
|
||||||
this._isChanging = true;
|
this._isChanging = true;
|
||||||
|
|
|
@ -118,7 +118,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
|
||||||
// Clone `this.props` so we don't mutate the input.
|
// Clone `this.props` so we don't mutate the input.
|
||||||
var props = merge(this.props);
|
var props = merge(this.props);
|
||||||
|
|
||||||
props.onChange = this.handleChange;
|
props.onChange = this._handleChange;
|
||||||
props.value = null;
|
props.value = null;
|
||||||
|
|
||||||
return select(props, this.props.children);
|
return select(props, this.props.children);
|
||||||
|
@ -128,7 +128,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
|
||||||
|
|
||||||
componentDidUpdate: updateOptions,
|
componentDidUpdate: updateOptions,
|
||||||
|
|
||||||
handleChange: function(event) {
|
_handleChange: function(event) {
|
||||||
var returnValue;
|
var returnValue;
|
||||||
if (this.props.onChange) {
|
if (this.props.onChange) {
|
||||||
this._isChanging = true;
|
this._isChanging = true;
|
||||||
|
|
|
@ -93,10 +93,6 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
|
||||||
return !this._isChanging;
|
return !this._isChanging;
|
||||||
},
|
},
|
||||||
|
|
||||||
getValue: function() {
|
|
||||||
return this.props.value != null ? this.props.value : this.state.value;
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
// Clone `this.props` so we don't mutate the input.
|
// Clone `this.props` so we don't mutate the input.
|
||||||
var props = merge(this.props);
|
var props = merge(this.props);
|
||||||
|
@ -106,8 +102,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
|
||||||
'`dangerouslySetInnerHTML` does not make sense on <textarea>.'
|
'`dangerouslySetInnerHTML` does not make sense on <textarea>.'
|
||||||
);
|
);
|
||||||
|
|
||||||
props.value = this.getValue();
|
props.value =
|
||||||
props.onChange = this.handleChange;
|
this.props.value != null ? this.props.value : this.state.value;
|
||||||
|
props.onChange = this._handleChange;
|
||||||
|
|
||||||
// Always set children to the same thing. In IE9, the selection range will
|
// Always set children to the same thing. In IE9, the selection range will
|
||||||
// get reset if `textContent` is mutated.
|
// get reset if `textContent` is mutated.
|
||||||
|
@ -124,7 +121,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleChange: function(event) {
|
_handleChange: function(event) {
|
||||||
var returnValue;
|
var returnValue;
|
||||||
if (this.props.onChange) {
|
if (this.props.onChange) {
|
||||||
this._isChanging = true;
|
this._isChanging = true;
|
||||||
|
|
Loading…
Reference in New Issue