react 0.12.2 → 0.13.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/JSXTransformer.js +6 -4
- package/dist/react-with-addons.js +4022 -3267
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +3853 -3358
- package/dist/react.min.js +6 -6
- package/lib/BeforeInputEventPlugin.js +388 -111
- package/lib/CSSPropertyOperations.js +20 -0
- package/lib/ChangeEventPlugin.js +2 -2
- package/lib/Danger.js +1 -1
- package/lib/DefaultEventPluginOrder.js +0 -1
- package/lib/ExecutionEnvironment.js +2 -3
- package/lib/FallbackCompositionState.js +87 -0
- package/lib/HTMLDOMPropertyConfig.js +1 -0
- package/lib/Object.assign.js +3 -1
- package/lib/React.js +14 -49
- package/lib/ReactBrowserComponentMixin.js +2 -12
- package/lib/ReactBrowserEventEmitter.js +2 -4
- package/lib/ReactCSSTransitionGroup.js +3 -0
- package/lib/ReactCSSTransitionGroupChild.js +8 -0
- package/lib/ReactChildReconciler.js +121 -0
- package/lib/ReactClass.js +916 -0
- package/lib/ReactComponent.js +36 -286
- package/lib/ReactComponentBrowserEnvironment.js +9 -82
- package/lib/ReactComponentEnvironment.js +57 -0
- package/lib/ReactCompositeComponent.js +608 -1026
- package/lib/ReactContext.js +5 -1
- package/lib/ReactDOM.js +2 -7
- package/lib/ReactDOMButton.js +4 -5
- package/lib/ReactDOMComponent.js +97 -69
- package/lib/ReactDOMForm.js +4 -5
- package/lib/ReactDOMIDOperations.js +55 -73
- package/lib/ReactDOMImg.js +3 -5
- package/lib/ReactDOMInput.js +4 -5
- package/lib/ReactDOMOption.js +4 -5
- package/lib/ReactDOMSelect.js +55 -63
- package/lib/ReactDOMSelection.js +5 -1
- package/lib/{ReactTextComponent.js → ReactDOMTextComponent.js} +54 -34
- package/lib/ReactDOMTextarea.js +4 -5
- package/lib/ReactDefaultInjection.js +13 -7
- package/lib/ReactDefaultPerf.js +6 -5
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +17 -11
- package/lib/ReactElementValidator.js +74 -37
- package/lib/ReactEmptyComponent.js +17 -10
- package/lib/ReactInjection.js +6 -4
- package/lib/ReactInputSelection.js +2 -3
- package/lib/ReactInstanceMap.js +47 -0
- package/lib/ReactMount.js +193 -64
- package/lib/ReactMultiChild.js +32 -42
- package/lib/ReactNativeComponent.js +45 -8
- package/lib/ReactOwner.js +3 -47
- package/lib/ReactPerf.js +20 -0
- package/lib/ReactPropTransferer.js +0 -55
- package/lib/ReactPropTypes.js +1 -17
- package/lib/ReactRef.js +96 -0
- package/lib/ReactServerRendering.js +3 -2
- package/lib/ReactTestUtils.js +82 -25
- package/lib/ReactTransitionGroup.js +47 -6
- package/lib/ReactUpdates.js +43 -42
- package/lib/SyntheticMouseEvent.js +1 -3
- package/lib/ViewportMetrics.js +1 -4
- package/lib/accumulate.js +47 -0
- package/lib/cloneWithProps.js +2 -2
- package/lib/copyProperties.js +2 -0
- package/lib/createFullPageComponent.js +2 -2
- package/lib/findDOMNode.js +52 -0
- package/lib/flattenChildren.js +1 -14
- package/lib/getIteratorFn.js +42 -0
- package/lib/instantiateReactComponent.js +88 -65
- package/lib/isNode.js +3 -4
- package/lib/isTextInputElement.js +1 -2
- package/lib/shouldUpdateReactComponent.js +13 -5
- package/lib/traverseAllChildren.js +110 -54
- package/package.json +1 -1
- package/lib/CompositionEventPlugin.js +0 -257
- package/lib/ReactLegacyElement.js +0 -243
- package/lib/deprecated.js +0 -47
package/lib/ReactDOMImg.js
CHANGED
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
var EventConstants = require("./EventConstants");
|
|
15
15
|
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
|
|
16
16
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
17
|
-
var
|
|
17
|
+
var ReactClass = require("./ReactClass");
|
|
18
18
|
var ReactElement = require("./ReactElement");
|
|
19
|
-
var ReactDOM = require("./ReactDOM");
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
var img = ReactElement.createFactory(ReactDOM.img.type);
|
|
20
|
+
var img = ReactElement.createFactory('img');
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
|
|
@@ -27,7 +25,7 @@ var img = ReactElement.createFactory(ReactDOM.img.type);
|
|
|
27
25
|
* to accomplish this, but the most reliable is to make <img> a composite
|
|
28
26
|
* component and use `componentDidMount` to attach the event handlers.
|
|
29
27
|
*/
|
|
30
|
-
var ReactDOMImg =
|
|
28
|
+
var ReactDOMImg = ReactClass.createClass({
|
|
31
29
|
displayName: 'ReactDOMImg',
|
|
32
30
|
tagName: 'IMG',
|
|
33
31
|
|
package/lib/ReactDOMInput.js
CHANGED
|
@@ -15,17 +15,15 @@ var AutoFocusMixin = require("./AutoFocusMixin");
|
|
|
15
15
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
16
16
|
var LinkedValueUtils = require("./LinkedValueUtils");
|
|
17
17
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
18
|
-
var
|
|
18
|
+
var ReactClass = require("./ReactClass");
|
|
19
19
|
var ReactElement = require("./ReactElement");
|
|
20
|
-
var ReactDOM = require("./ReactDOM");
|
|
21
20
|
var ReactMount = require("./ReactMount");
|
|
22
21
|
var ReactUpdates = require("./ReactUpdates");
|
|
23
22
|
|
|
24
23
|
var assign = require("./Object.assign");
|
|
25
24
|
var invariant = require("./invariant");
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
var input = ReactElement.createFactory(ReactDOM.input.type);
|
|
26
|
+
var input = ReactElement.createFactory('input');
|
|
29
27
|
|
|
30
28
|
var instancesByReactID = {};
|
|
31
29
|
|
|
@@ -52,8 +50,9 @@ function forceUpdateIfMounted() {
|
|
|
52
50
|
*
|
|
53
51
|
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
|
|
54
52
|
*/
|
|
55
|
-
var ReactDOMInput =
|
|
53
|
+
var ReactDOMInput = ReactClass.createClass({
|
|
56
54
|
displayName: 'ReactDOMInput',
|
|
55
|
+
tagName: 'INPUT',
|
|
57
56
|
|
|
58
57
|
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
|
|
59
58
|
|
package/lib/ReactDOMOption.js
CHANGED
|
@@ -12,20 +12,19 @@
|
|
|
12
12
|
"use strict";
|
|
13
13
|
|
|
14
14
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
15
|
-
var
|
|
15
|
+
var ReactClass = require("./ReactClass");
|
|
16
16
|
var ReactElement = require("./ReactElement");
|
|
17
|
-
var ReactDOM = require("./ReactDOM");
|
|
18
17
|
|
|
19
18
|
var warning = require("./warning");
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
var option = ReactElement.createFactory(ReactDOM.option.type);
|
|
20
|
+
var option = ReactElement.createFactory('option');
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* Implements an <option> native component that warns when `selected` is set.
|
|
26
24
|
*/
|
|
27
|
-
var ReactDOMOption =
|
|
25
|
+
var ReactDOMOption = ReactClass.createClass({
|
|
28
26
|
displayName: 'ReactDOMOption',
|
|
27
|
+
tagName: 'OPTION',
|
|
29
28
|
|
|
30
29
|
mixins: [ReactBrowserComponentMixin],
|
|
31
30
|
|
package/lib/ReactDOMSelect.js
CHANGED
|
@@ -14,21 +14,22 @@
|
|
|
14
14
|
var AutoFocusMixin = require("./AutoFocusMixin");
|
|
15
15
|
var LinkedValueUtils = require("./LinkedValueUtils");
|
|
16
16
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
17
|
-
var
|
|
17
|
+
var ReactClass = require("./ReactClass");
|
|
18
18
|
var ReactElement = require("./ReactElement");
|
|
19
|
-
var ReactDOM = require("./ReactDOM");
|
|
20
19
|
var ReactUpdates = require("./ReactUpdates");
|
|
21
20
|
|
|
22
21
|
var assign = require("./Object.assign");
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
var select = ReactElement.createFactory(ReactDOM.select.type);
|
|
23
|
+
var select = ReactElement.createFactory('select');
|
|
26
24
|
|
|
27
|
-
function
|
|
25
|
+
function updateOptionsIfPendingUpdateAndMounted() {
|
|
28
26
|
/*jshint validthis:true */
|
|
29
|
-
if (this.
|
|
30
|
-
this.
|
|
31
|
-
|
|
27
|
+
if (this._pendingUpdate) {
|
|
28
|
+
this._pendingUpdate = false;
|
|
29
|
+
var value = LinkedValueUtils.getValue(this);
|
|
30
|
+
if (value != null && this.isMounted()) {
|
|
31
|
+
updateOptions(this, value);
|
|
32
|
+
}
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -58,40 +59,43 @@ function selectValueType(props, propName, componentName) {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
|
-
* If `value` is supplied, updates <option> elements on mount and update.
|
|
62
62
|
* @param {ReactComponent} component Instance of ReactDOMSelect
|
|
63
|
-
* @param {
|
|
64
|
-
* controlled components, a string (or with `multiple`, a list of strings).
|
|
63
|
+
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
|
|
65
64
|
* @private
|
|
66
65
|
*/
|
|
67
66
|
function updateOptions(component, propValue) {
|
|
68
|
-
var multiple = component.props.multiple;
|
|
69
|
-
var value = propValue != null ? propValue : component.state.value;
|
|
70
|
-
var options = component.getDOMNode().options;
|
|
71
67
|
var selectedValue, i, l;
|
|
72
|
-
|
|
68
|
+
var options = component.getDOMNode().options;
|
|
69
|
+
|
|
70
|
+
if (component.props.multiple) {
|
|
73
71
|
selectedValue = {};
|
|
74
|
-
for (i = 0, l =
|
|
75
|
-
selectedValue['' +
|
|
72
|
+
for (i = 0, l = propValue.length; i < l; i++) {
|
|
73
|
+
selectedValue['' + propValue[i]] = true;
|
|
74
|
+
}
|
|
75
|
+
for (i = 0, l = options.length; i < l; i++) {
|
|
76
|
+
var selected = selectedValue.hasOwnProperty(options[i].value);
|
|
77
|
+
if (options[i].selected !== selected) {
|
|
78
|
+
options[i].selected = selected;
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
} else {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
options[i].selected = selected;
|
|
82
|
+
// Do not set `select.value` as exact behavior isn't consistent across all
|
|
83
|
+
// browsers for all cases.
|
|
84
|
+
selectedValue = '' + propValue;
|
|
85
|
+
for (i = 0, l = options.length; i < l; i++) {
|
|
86
|
+
if (options[i].value === selectedValue) {
|
|
87
|
+
options[i].selected = true;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
87
90
|
}
|
|
91
|
+
options[0].selected = true;
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
/**
|
|
92
96
|
* Implements a <select> native component that allows optionally setting the
|
|
93
97
|
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
|
|
94
|
-
*
|
|
98
|
+
* stringable. If `multiple` is true, the prop must be an array of stringables.
|
|
95
99
|
*
|
|
96
100
|
* If `value` is not supplied (or null/undefined), user actions that change the
|
|
97
101
|
* selected option will trigger updates to the rendered options.
|
|
@@ -103,8 +107,9 @@ function updateOptions(component, propValue) {
|
|
|
103
107
|
* If `defaultValue` is provided, any options with the supplied values will be
|
|
104
108
|
* selected.
|
|
105
109
|
*/
|
|
106
|
-
var ReactDOMSelect =
|
|
110
|
+
var ReactDOMSelect = ReactClass.createClass({
|
|
107
111
|
displayName: 'ReactDOMSelect',
|
|
112
|
+
tagName: 'SELECT',
|
|
108
113
|
|
|
109
114
|
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
|
|
110
115
|
|
|
@@ -113,22 +118,6 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
|
|
|
113
118
|
value: selectValueType
|
|
114
119
|
},
|
|
115
120
|
|
|
116
|
-
getInitialState: function() {
|
|
117
|
-
return {value: this.props.defaultValue || (this.props.multiple ? [] : '')};
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
componentWillMount: function() {
|
|
121
|
-
this._pendingValue = null;
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
componentWillReceiveProps: function(nextProps) {
|
|
125
|
-
if (!this.props.multiple && nextProps.multiple) {
|
|
126
|
-
this.setState({value: [this.state.value]});
|
|
127
|
-
} else if (this.props.multiple && !nextProps.multiple) {
|
|
128
|
-
this.setState({value: this.state.value[0]});
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
|
|
132
121
|
render: function() {
|
|
133
122
|
// Clone `this.props` so we don't mutate the input.
|
|
134
123
|
var props = assign({}, this.props);
|
|
@@ -139,16 +128,32 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
|
|
|
139
128
|
return select(props, this.props.children);
|
|
140
129
|
},
|
|
141
130
|
|
|
131
|
+
componentWillMount: function() {
|
|
132
|
+
this._pendingUpdate = false;
|
|
133
|
+
},
|
|
134
|
+
|
|
142
135
|
componentDidMount: function() {
|
|
143
|
-
|
|
136
|
+
var value = LinkedValueUtils.getValue(this);
|
|
137
|
+
if (value != null) {
|
|
138
|
+
updateOptions(this, value);
|
|
139
|
+
} else if (this.props.defaultValue != null) {
|
|
140
|
+
updateOptions(this, this.props.defaultValue);
|
|
141
|
+
}
|
|
144
142
|
},
|
|
145
143
|
|
|
146
144
|
componentDidUpdate: function(prevProps) {
|
|
147
145
|
var value = LinkedValueUtils.getValue(this);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (value != null || prevMultiple !== multiple) {
|
|
146
|
+
if (value != null) {
|
|
147
|
+
this._pendingUpdate = false;
|
|
151
148
|
updateOptions(this, value);
|
|
149
|
+
} else if (!prevProps.multiple !== !this.props.multiple) {
|
|
150
|
+
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
|
|
151
|
+
if (this.props.defaultValue != null) {
|
|
152
|
+
updateOptions(this, this.props.defaultValue);
|
|
153
|
+
} else {
|
|
154
|
+
// Revert the select back to its default unselected state.
|
|
155
|
+
updateOptions(this, this.props.multiple ? [] : '');
|
|
156
|
+
}
|
|
152
157
|
}
|
|
153
158
|
},
|
|
154
159
|
|
|
@@ -159,21 +164,8 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
|
|
|
159
164
|
returnValue = onChange.call(this, event);
|
|
160
165
|
}
|
|
161
166
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
selectedValue = [];
|
|
165
|
-
var options = event.target.options;
|
|
166
|
-
for (var i = 0, l = options.length; i < l; i++) {
|
|
167
|
-
if (options[i].selected) {
|
|
168
|
-
selectedValue.push(options[i].value);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
selectedValue = event.target.value;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
this._pendingValue = selectedValue;
|
|
176
|
-
ReactUpdates.asap(updateWithPendingValueIfMounted, this);
|
|
167
|
+
this._pendingUpdate = true;
|
|
168
|
+
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
|
|
177
169
|
return returnValue;
|
|
178
170
|
}
|
|
179
171
|
|
package/lib/ReactDOMSelection.js
CHANGED
|
@@ -189,7 +189,11 @@ function setModernOffsets(node, offsets) {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
var useIEOffsets =
|
|
192
|
+
var useIEOffsets = (
|
|
193
|
+
ExecutionEnvironment.canUseDOM &&
|
|
194
|
+
'selection' in document &&
|
|
195
|
+
!('getSelection' in window)
|
|
196
|
+
);
|
|
193
197
|
|
|
194
198
|
var ReactDOMSelection = {
|
|
195
199
|
/**
|
|
@@ -6,18 +6,20 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule
|
|
9
|
+
* @providesModule ReactDOMTextComponent
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
"use strict";
|
|
14
14
|
|
|
15
15
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
16
|
-
var
|
|
17
|
-
|
|
16
|
+
var ReactComponentBrowserEnvironment =
|
|
17
|
+
require("./ReactComponentBrowserEnvironment");
|
|
18
|
+
var ReactDOMComponent = require("./ReactDOMComponent");
|
|
18
19
|
|
|
19
20
|
var assign = require("./Object.assign");
|
|
20
21
|
var escapeTextForBrowser = require("./escapeTextForBrowser");
|
|
22
|
+
var invariant = require("./invariant");
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* Text nodes violate a couple assumptions that React makes about components:
|
|
@@ -30,15 +32,29 @@ var escapeTextForBrowser = require("./escapeTextForBrowser");
|
|
|
30
32
|
*
|
|
31
33
|
* TODO: Investigate representing React components in the DOM with text nodes.
|
|
32
34
|
*
|
|
33
|
-
* @class
|
|
35
|
+
* @class ReactDOMTextComponent
|
|
34
36
|
* @extends ReactComponent
|
|
35
37
|
* @internal
|
|
36
38
|
*/
|
|
37
|
-
var
|
|
38
|
-
// This constructor and
|
|
39
|
+
var ReactDOMTextComponent = function(props) {
|
|
40
|
+
// This constructor and its argument is currently used by mocks.
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
assign(
|
|
43
|
+
assign(ReactDOMTextComponent.prototype, {
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {ReactText} text
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
construct: function(text) {
|
|
50
|
+
// TODO: This is really a ReactText (ReactNode), not a ReactElement
|
|
51
|
+
this._currentElement = text;
|
|
52
|
+
this._stringText = '' + text;
|
|
53
|
+
|
|
54
|
+
// Properties
|
|
55
|
+
this._rootNodeID = null;
|
|
56
|
+
this._mountIndex = 0;
|
|
57
|
+
},
|
|
42
58
|
|
|
43
59
|
/**
|
|
44
60
|
* Creates the markup for this text node. This node is not intended to have
|
|
@@ -46,19 +62,12 @@ assign(ReactTextComponent.prototype, ReactComponent.Mixin, {
|
|
|
46
62
|
*
|
|
47
63
|
* @param {string} rootID DOM ID of the root node.
|
|
48
64
|
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
|
49
|
-
* @param {number} mountDepth number of components in the owner hierarchy
|
|
50
65
|
* @return {string} Markup for this text node.
|
|
51
66
|
* @internal
|
|
52
67
|
*/
|
|
53
|
-
mountComponent: function(rootID, transaction,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
rootID,
|
|
57
|
-
transaction,
|
|
58
|
-
mountDepth
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
var escapedText = escapeTextForBrowser(this.props);
|
|
68
|
+
mountComponent: function(rootID, transaction, context) {
|
|
69
|
+
this._rootNodeID = rootID;
|
|
70
|
+
var escapedText = escapeTextForBrowser(this._stringText);
|
|
62
71
|
|
|
63
72
|
if (transaction.renderToStaticMarkup) {
|
|
64
73
|
// Normally we'd wrap this in a `span` for the reasons stated above, but
|
|
@@ -77,28 +86,39 @@ assign(ReactTextComponent.prototype, ReactComponent.Mixin, {
|
|
|
77
86
|
/**
|
|
78
87
|
* Updates this component by updating the text content.
|
|
79
88
|
*
|
|
80
|
-
* @param {
|
|
89
|
+
* @param {ReactText} nextText The next text content
|
|
81
90
|
* @param {ReactReconcileTransaction} transaction
|
|
82
91
|
* @internal
|
|
83
92
|
*/
|
|
84
|
-
receiveComponent: function(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
receiveComponent: function(nextText, transaction) {
|
|
94
|
+
if (nextText !== this._currentElement) {
|
|
95
|
+
this._currentElement = nextText;
|
|
96
|
+
var nextStringText = '' + nextText;
|
|
97
|
+
if (nextStringText !== this._stringText) {
|
|
98
|
+
// TODO: Save this as pending props and use performUpdateIfNecessary
|
|
99
|
+
// and/or updateComponent to do the actual update for consistency with
|
|
100
|
+
// other component types?
|
|
101
|
+
this._stringText = nextStringText;
|
|
102
|
+
ReactDOMComponent.BackendIDOperations.updateTextContentByID(
|
|
103
|
+
this._rootNodeID,
|
|
104
|
+
nextStringText
|
|
105
|
+
);
|
|
106
|
+
}
|
|
92
107
|
}
|
|
93
|
-
}
|
|
108
|
+
},
|
|
94
109
|
|
|
95
|
-
|
|
110
|
+
updateComponent: function() {
|
|
111
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
112
|
+
false,
|
|
113
|
+
'ReactDOMTextComponent: updateComponent() should never be called'
|
|
114
|
+
) : invariant(false));
|
|
115
|
+
},
|
|
96
116
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
117
|
+
unmountComponent: function() {
|
|
118
|
+
// TODO: Is this necessary?
|
|
119
|
+
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
|
120
|
+
}
|
|
101
121
|
|
|
102
|
-
|
|
122
|
+
});
|
|
103
123
|
|
|
104
|
-
module.exports =
|
|
124
|
+
module.exports = ReactDOMTextComponent;
|
package/lib/ReactDOMTextarea.js
CHANGED
|
@@ -15,9 +15,8 @@ var AutoFocusMixin = require("./AutoFocusMixin");
|
|
|
15
15
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
16
16
|
var LinkedValueUtils = require("./LinkedValueUtils");
|
|
17
17
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
18
|
-
var
|
|
18
|
+
var ReactClass = require("./ReactClass");
|
|
19
19
|
var ReactElement = require("./ReactElement");
|
|
20
|
-
var ReactDOM = require("./ReactDOM");
|
|
21
20
|
var ReactUpdates = require("./ReactUpdates");
|
|
22
21
|
|
|
23
22
|
var assign = require("./Object.assign");
|
|
@@ -25,8 +24,7 @@ var invariant = require("./invariant");
|
|
|
25
24
|
|
|
26
25
|
var warning = require("./warning");
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
var textarea = ReactElement.createFactory(ReactDOM.textarea.type);
|
|
27
|
+
var textarea = ReactElement.createFactory('textarea');
|
|
30
28
|
|
|
31
29
|
function forceUpdateIfMounted() {
|
|
32
30
|
/*jshint validthis:true */
|
|
@@ -50,8 +48,9 @@ function forceUpdateIfMounted() {
|
|
|
50
48
|
* The rendered element will be initialized with an empty value, the prop
|
|
51
49
|
* `defaultValue` if specified, or the children content (deprecated).
|
|
52
50
|
*/
|
|
53
|
-
var ReactDOMTextarea =
|
|
51
|
+
var ReactDOMTextarea = ReactClass.createClass({
|
|
54
52
|
displayName: 'ReactDOMTextarea',
|
|
53
|
+
tagName: 'TEXTAREA',
|
|
55
54
|
|
|
56
55
|
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
|
|
57
56
|
|