ReactNativeComponent -> ReactDOMComponent
In an effort to break the DOMy parts of React away from the non-DOMy parts, I'm renaming this.
Paul O'Shannessy committed
Oct 1, 2013 at 15:46 UTC
f43449d333089b4e06088c832d86e47be7de6142
12 files changed
+41
-41
src/core/ReactDOM.js
+3
-3
@@ -19,7 +19,7 @@
19
20
"use strict";
21
22
-var ReactNativeComponent = require('ReactNativeComponent');
22
+var ReactDOMComponent = require('ReactDOMComponent');
23
24
var mergeInto = require('mergeInto');
25
var objMapKeyVal = require('objMapKeyVal');
@@ -41,7 +41,7 @@ var objMapKeyVal = require('objMapKeyVal');
41
*/
42
function createDOMComponentClass(tag, omitClose) {
43
var Constructor = function() {};
44
- Constructor.prototype = new ReactNativeComponent(tag, omitClose);
44
+ Constructor.prototype = new ReactDOMComponent(tag, omitClose);
45
Constructor.prototype.constructor = Constructor;
46
47
var ConvenienceConstructor = function(props, children) {
@@ -54,7 +54,7 @@ function createDOMComponentClass(tag, omitClose) {
54
}
55
56
/**
57
- * Creates a mapping from supported HTML tags to `ReactNativeComponent` classes.
57
+ * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
58
* This is also accessible via `React.DOM`.
59
*
60
* @public
src/core/ReactDOMComponent.js
renamed
+10
-10
@@ -13,7 +13,7 @@
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
- * @providesModule ReactNativeComponent
16
+ * @providesModule ReactDOMComponent
17
* @typechecks static-only
18
*/
19
@@ -64,17 +64,17 @@ function assertValidProps(props) {
64
}
65
66
/**
67
- * @constructor ReactNativeComponent
67
+ * @constructor ReactDOMComponent
68
* @extends ReactComponent
69
* @extends ReactMultiChild
70
*/
71
-function ReactNativeComponent(tag, omitClose) {
71
+function ReactDOMComponent(tag, omitClose) {
72
this._tagOpen = '<' + tag;
73
this._tagClose = omitClose ? '' : '</' + tag + '>';
74
this.tagName = tag.toUpperCase();
75
}
76
77
-ReactNativeComponent.Mixin = {
77
+ReactDOMComponent.Mixin = {
78
79
/**
80
* Generates root tag markup then recurses. This method has side effects and
@@ -87,7 +87,7 @@ ReactNativeComponent.Mixin = {
87
* @return {string} The computed markup.
88
*/
89
mountComponent: ReactPerf.measure(
90
- 'ReactNativeComponent',
90
+ 'ReactDOMComponent',
91
'mountComponent',
92
function(rootID, transaction, mountDepth) {
93
ReactComponent.Mixin.mountComponent.call(
@@ -195,7 +195,7 @@ ReactNativeComponent.Mixin = {
195
* @overridable
196
*/
197
updateComponent: ReactPerf.measure(
198
- 'ReactNativeComponent',
198
+ 'ReactDOMComponent',
199
'updateComponent',
200
function(transaction, prevProps) {
201
ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps);
@@ -364,8 +364,8 @@ ReactNativeComponent.Mixin = {
364
365
};
366
367
-mixInto(ReactNativeComponent, ReactComponent.Mixin);
368
-mixInto(ReactNativeComponent, ReactNativeComponent.Mixin);
369
-mixInto(ReactNativeComponent, ReactMultiChild.Mixin);
367
+mixInto(ReactDOMComponent, ReactComponent.Mixin);
368
+mixInto(ReactDOMComponent, ReactDOMComponent.Mixin);
369
+mixInto(ReactDOMComponent, ReactMultiChild.Mixin);
370
371
-module.exports = ReactNativeComponent;
371
+module.exports = ReactDOMComponent;
src/core/ReactMultiChild.js
+2
-2
@@ -179,7 +179,7 @@ var ReactMultiChild = {
179
180
/**
181
* Provides common functionality for components that must reconcile multiple
182
- * children. This is used by `ReactNativeComponent` to mount, update, and
182
+ * children. This is used by `ReactDOMComponent` to mount, update, and
183
* unmount child components.
184
*
185
* @lends {ReactMultiChild.prototype}
@@ -188,7 +188,7 @@ var ReactMultiChild = {
188
189
/**
190
* Generates a "mount image" for each of the supplied children. In the case
191
- * of `ReactNativeComponent`, a mount image is a string of markup.
191
+ * of `ReactDOMComponent`, a mount image is a string of markup.
192
*
193
* @param {?object} children As returned by `flattenChildren`.
194
* @return {array} An array of mounted representations.
src/core/__tests__/ReactDOMComponent-test.js
renamed
+7
-7
@@ -23,7 +23,7 @@
23
24
var mocks = require('mocks');
25
26
-describe('ReactNativeComponent', function() {
26
+describe('ReactDOMComponent', function() {
27
28
describe('updateDOM', function() {
29
var React;
@@ -220,13 +220,13 @@ describe('ReactNativeComponent', function() {
220
ReactDefaultInjection.inject();
221
222
var mixInto = require('mixInto');
223
- var ReactNativeComponent = require('ReactNativeComponent');
223
+ var ReactDOMComponent = require('ReactDOMComponent');
224
225
var NodeStub = function(initialProps) {
226
this.props = initialProps || {};
227
this._rootNodeID = 'test';
228
};
229
- mixInto(NodeStub, ReactNativeComponent.Mixin);
229
+ mixInto(NodeStub, ReactDOMComponent.Mixin);
230
231
genMarkup = function(props) {
232
return (new NodeStub(props))._createOpenTagMarkup();
@@ -261,14 +261,14 @@ describe('ReactNativeComponent', function() {
261
require('mock-modules').dumpCache();
262
263
var mixInto = require('mixInto');
264
- var ReactNativeComponent = require('ReactNativeComponent');
264
+ var ReactDOMComponent = require('ReactDOMComponent');
265
var ReactReconcileTransaction = require('ReactReconcileTransaction');
266
267
var NodeStub = function(initialProps) {
268
this.props = initialProps || {};
269
this._rootNodeID = 'test';
270
};
271
- mixInto(NodeStub, ReactNativeComponent.Mixin);
271
+ mixInto(NodeStub, ReactDOMComponent.Mixin);
272
273
genMarkup = function(props) {
274
var transaction = new ReactReconcileTransaction();
@@ -300,14 +300,14 @@ describe('ReactNativeComponent', function() {
300
var mixInto = require('mixInto');
301
var ReactComponent = require('ReactComponent');
302
var ReactMultiChild = require('ReactMultiChild');
303
- var ReactNativeComponent = require('ReactNativeComponent');
303
+ var ReactDOMComponent = require('ReactDOMComponent');
304
var ReactReconcileTransaction = require('ReactReconcileTransaction');
305
306
var StubNativeComponent = function(initialProps) {
307
ReactComponent.Mixin.construct.call(this, initialProps);
308
};
309
mixInto(StubNativeComponent, ReactComponent.Mixin);
310
- mixInto(StubNativeComponent, ReactNativeComponent.Mixin);
310
+ mixInto(StubNativeComponent, ReactDOMComponent.Mixin);
311
mixInto(StubNativeComponent, ReactMultiChild.Mixin);
312
313
mountComponent = function(props) {
src/dom/components/ReactDOMButton.js
+1
-1
@@ -23,7 +23,7 @@ var ReactDOM = require('ReactDOM');
23
24
var keyMirror = require('keyMirror');
25
26
-// Store a reference to the <button> `ReactNativeComponent`.
26
+// Store a reference to the <button> `ReactDOMComponent`.
27
var button = ReactDOM.button;
28
29
var mouseListenerNames = keyMirror({
src/dom/components/ReactDOMForm.js
+1
-1
@@ -23,7 +23,7 @@ var ReactDOM = require('ReactDOM');
23
var ReactEventEmitter = require('ReactEventEmitter');
24
var EventConstants = require('EventConstants');
25
26
-// Store a reference to the <form> `ReactNativeComponent`.
26
+// Store a reference to the <form> `ReactDOMComponent`.
27
var form = ReactDOM.form;
28
29
/**
src/dom/components/ReactDOMInput.js
+1
-1
@@ -27,7 +27,7 @@ var ReactMount = require('ReactMount');
27
var invariant = require('invariant');
28
var merge = require('merge');
29
30
-// Store a reference to the <input> `ReactNativeComponent`.
30
+// Store a reference to the <input> `ReactDOMComponent`.
31
var input = ReactDOM.input;
32
33
var instancesByReactID = {};
src/dom/components/ReactDOMOption.js
+1
-1
@@ -21,7 +21,7 @@
21
var ReactCompositeComponent = require('ReactCompositeComponent');
22
var ReactDOM = require('ReactDOM');
23
24
-// Store a reference to the <option> `ReactNativeComponent`.
24
+// Store a reference to the <option> `ReactDOMComponent`.
25
var option = ReactDOM.option;
26
27
/**
src/dom/components/ReactDOMSelect.js
+1
-1
@@ -25,7 +25,7 @@ var ReactDOM = require('ReactDOM');
25
var invariant = require('invariant');
26
var merge = require('merge');
27
28
-// Store a reference to the <select> `ReactNativeComponent`.
28
+// Store a reference to the <select> `ReactDOMComponent`.
29
var select = ReactDOM.select;
30
31
/**
src/dom/components/ReactDOMTextarea.js
+2
-2
@@ -26,7 +26,7 @@ var ReactDOM = require('ReactDOM');
26
var invariant = require('invariant');
27
var merge = require('merge');
28
29
-// Store a reference to the <textarea> `ReactNativeComponent`.
29
+// Store a reference to the <textarea> `ReactDOMComponent`.
30
var textarea = ReactDOM.textarea;
31
32
// For quickly matching children type, to test if can be treated as content.
@@ -84,7 +84,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
84
}
85
var value = this.getValue();
86
return {
87
- // We save the initial value so that `ReactNativeComponent` doesn't update
87
+ // We save the initial value so that `ReactDOMComponent` doesn't update
88
// `textContent` (unnecessary since we update value).
89
initialValue: value != null ? value : defaultValue,
90
value: defaultValue
src/test/ReactDefaultPerf.js
+3
-3
@@ -307,8 +307,8 @@ if (__DEV__) {
307
switch (objName + '.' + fnName) {
308
case 'React.renderComponent':
309
return _renderComponentCallback;
310
- case 'ReactNativeComponent.mountComponent':
311
- case 'ReactNativeComponent.updateComponent':
310
+ case 'ReactDOMComponent.mountComponent':
311
+ case 'ReactDOMComponent.updateComponent':
312
return _nativeComponentCallback;
313
case 'ReactCompositeComponent.mountComponent':
314
case 'ReactCompositeComponent.updateComponent':
@@ -355,7 +355,7 @@ if (__DEV__) {
355
};
356
357
/**
358
- * Callback function for ReactNativeComponent
358
+ * Callback function for ReactDOMComponent
359
*
360
* @param {object} component
361
* @param {object} args
src/test/ReactTestUtils.js
+9
-9
@@ -122,7 +122,7 @@ var ReactTestUtils = {
122
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
123
* and returns that one result, or throws exception if there is any other
124
* number of matches besides one.
125
- * @return {!ReactNativeComponent} The one match.
125
+ * @return {!ReactDOMComponent} The one match.
126
*/
127
findRenderedDOMComponentWithClass: function(root, className) {
128
var all =
@@ -150,7 +150,7 @@ var ReactTestUtils = {
150
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
151
* and returns that one result, or throws exception if there is any other
152
* number of matches besides one.
153
- * @return {!ReactNativeComponent} The one match.
153
+ * @return {!ReactDOMComponent} The one match.
154
*/
155
findRenderedDOMComponentWithTag: function(root, tagName) {
156
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
@@ -208,9 +208,9 @@ var ReactTestUtils = {
208
209
/**
210
* Simulates a top level event being dispatched from a raw event that occured
211
- * on the `ReactNativeComponent` `comp`.
211
+ * on the `ReactDOMComponent` `comp`.
212
* @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
213
- * @param comp {!ReactNativeComponent}
213
+ * @param comp {!ReactDOMComponent}
214
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
215
*/
216
simulateEventOnDOMComponent: function(topLevelType, comp, fakeNativeEvent) {
@@ -243,10 +243,10 @@ var ReactTestUtils = {
243
/**
244
* Exports:
245
*
246
- * - `ReactTestUtils.Simulate.click(Element/ReactNativeComponent)`
247
- * - `ReactTestUtils.Simulate.mouseMove(Element/ReactNativeComponent)`
248
- * - `ReactTestUtils.Simulate.mouseIn/ReactNativeComponent)`
249
- * - `ReactTestUtils.Simulate.mouseOut(Element/ReactNativeComponent)`
246
+ * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
247
+ * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
248
+ * - `ReactTestUtils.Simulate.mouseIn/ReactDOMComponent)`
249
+ * - `ReactTestUtils.Simulate.mouseOut(Element/ReactDOMComponent)`
250
* - ... (All keys from `EventConstants.topLevelTypes`)
251
*
252
* Note: Top level event types are a subset of the entire set of handler types
@@ -287,7 +287,7 @@ for (eventType in topLevelTypes) {
287
var convenienceName = eventType.indexOf('top') === 0 ?
288
eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
289
/**
290
- * @param {!Element || ReactNativeComponent} domComponentOrNode
290
+ * @param {!Element || ReactDOMComponent} domComponentOrNode
291
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
292
*/
293
ReactTestUtils.Simulate[convenienceName] = makeSimulator(eventType);