Make getChecked, getValue, handleChange private
Test Plan: grunt test, enter text in ballmer-peak example without any JS errors.
Ben Alpert committed
Aug 17, 2013 at 17:04 UTC
898621d0a1d4ca36f56f728bce54f370790a9ce0
3 files changed
+13
-22
src/dom/components/ReactDOMInput.js
+7
-13
@@ -57,22 +57,16 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
57
return !this._isChanging;
58
},
59
60
- getChecked: function() {
61
- return this.props.checked != null ? this.props.checked : this.state.checked;
62
- },
63
-
64
- getValue: function() {
65
- // Cast `this.props.value` to a string so equality checks pass.
66
- return this.props.value != null ? '' + this.props.value : this.state.value;
67
- },
68
-
60
render: function() {
61
// Clone `this.props` so we don't mutate the input.
62
var props = merge(this.props);
63
73
- props.checked = this.getChecked();
74
- props.value = this.getValue();
75
- props.onChange = this.handleChange;
64
+ props.checked =
65
+ this.props.checked != null ? this.props.checked : this.state.checked;
66
+ // Cast `this.props.value` to a string so equality checks pass.
67
+ props.value =
68
+ this.props.value != null ? '' + this.props.value : this.state.value;
69
+ props.onChange = this._handleChange;
70
71
return input(props, this.props.children);
72
},
@@ -96,7 +90,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
90
}
91
},
92
99
- handleChange: function(event) {
93
+ _handleChange: function(event) {
94
var returnValue;
95
if (this.props.onChange) {
96
this._isChanging = true;
src/dom/components/ReactDOMSelect.js
+2
-2
@@ -118,7 +118,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
118
// Clone `this.props` so we don't mutate the input.
119
var props = merge(this.props);
120
121
- props.onChange = this.handleChange;
121
+ props.onChange = this._handleChange;
122
props.value = null;
123
124
return select(props, this.props.children);
@@ -128,7 +128,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
128
129
componentDidUpdate: updateOptions,
130
131
- handleChange: function(event) {
131
+ _handleChange: function(event) {
132
var returnValue;
133
if (this.props.onChange) {
134
this._isChanging = true;
src/dom/components/ReactDOMTextarea.js
+4
-7
@@ -93,10 +93,6 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
93
return !this._isChanging;
94
},
95
96
- getValue: function() {
97
- return this.props.value != null ? this.props.value : this.state.value;
98
- },
99
-
96
render: function() {
97
// Clone `this.props` so we don't mutate the input.
98
var props = merge(this.props);
@@ -106,8 +102,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
102
'`dangerouslySetInnerHTML` does not make sense on <textarea>.'
103
);
104
109
- props.value = this.getValue();
110
- props.onChange = this.handleChange;
105
+ props.value =
106
+ this.props.value != null ? this.props.value : this.state.value;
107
+ props.onChange = this._handleChange;
108
109
// Always set children to the same thing. In IE9, the selection range will
110
// get reset if `textContent` is mutated.
@@ -124,7 +121,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
121
}
122
},
123
127
- handleChange: function(event) {
124
+ _handleChange: function(event) {
125
var returnValue;
126
if (this.props.onChange) {
127
this._isChanging = true;