Skip to content

Commit

Permalink
ReactNativeComponent -> ReactDOMComponent
Browse files Browse the repository at this point in the history
In an effort to break the DOMy parts of React away from the non-DOMy parts, I'm renaming this.
  • Loading branch information
zpao committed Oct 1, 2013
1 parent e66287f commit f43449d
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions src/core/ReactDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

"use strict";

var ReactNativeComponent = require('ReactNativeComponent');
var ReactDOMComponent = require('ReactDOMComponent');

var mergeInto = require('mergeInto');
var objMapKeyVal = require('objMapKeyVal');
Expand All @@ -41,7 +41,7 @@ var objMapKeyVal = require('objMapKeyVal');
*/
function createDOMComponentClass(tag, omitClose) {
var Constructor = function() {};
Constructor.prototype = new ReactNativeComponent(tag, omitClose);
Constructor.prototype = new ReactDOMComponent(tag, omitClose);
Constructor.prototype.constructor = Constructor;

var ConvenienceConstructor = function(props, children) {
Expand All @@ -54,7 +54,7 @@ function createDOMComponentClass(tag, omitClose) {
}

/**
* Creates a mapping from supported HTML tags to `ReactNativeComponent` classes.
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
Expand Down
20 changes: 10 additions & 10 deletions src/core/ReactNativeComponent.js → src/core/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactNativeComponent
* @providesModule ReactDOMComponent
* @typechecks static-only
*/

Expand Down Expand Up @@ -64,17 +64,17 @@ function assertValidProps(props) {
}

/**
* @constructor ReactNativeComponent
* @constructor ReactDOMComponent
* @extends ReactComponent
* @extends ReactMultiChild
*/
function ReactNativeComponent(tag, omitClose) {
function ReactDOMComponent(tag, omitClose) {
this._tagOpen = '<' + tag;
this._tagClose = omitClose ? '' : '</' + tag + '>';
this.tagName = tag.toUpperCase();
}

ReactNativeComponent.Mixin = {
ReactDOMComponent.Mixin = {

/**
* Generates root tag markup then recurses. This method has side effects and
Expand All @@ -87,7 +87,7 @@ ReactNativeComponent.Mixin = {
* @return {string} The computed markup.
*/
mountComponent: ReactPerf.measure(
'ReactNativeComponent',
'ReactDOMComponent',
'mountComponent',
function(rootID, transaction, mountDepth) {
ReactComponent.Mixin.mountComponent.call(
Expand Down Expand Up @@ -195,7 +195,7 @@ ReactNativeComponent.Mixin = {
* @overridable
*/
updateComponent: ReactPerf.measure(
'ReactNativeComponent',
'ReactDOMComponent',
'updateComponent',
function(transaction, prevProps) {
ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps);
Expand Down Expand Up @@ -364,8 +364,8 @@ ReactNativeComponent.Mixin = {

};

mixInto(ReactNativeComponent, ReactComponent.Mixin);
mixInto(ReactNativeComponent, ReactNativeComponent.Mixin);
mixInto(ReactNativeComponent, ReactMultiChild.Mixin);
mixInto(ReactDOMComponent, ReactComponent.Mixin);
mixInto(ReactDOMComponent, ReactDOMComponent.Mixin);
mixInto(ReactDOMComponent, ReactMultiChild.Mixin);

module.exports = ReactNativeComponent;
module.exports = ReactDOMComponent;
4 changes: 2 additions & 2 deletions src/core/ReactMultiChild.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ var ReactMultiChild = {

/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactNativeComponent` to mount, update, and
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
Expand All @@ -188,7 +188,7 @@ var ReactMultiChild = {

/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactNativeComponent`, a mount image is a string of markup.
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} children As returned by `flattenChildren`.
* @return {array} An array of mounted representations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

var mocks = require('mocks');

describe('ReactNativeComponent', function() {
describe('ReactDOMComponent', function() {

describe('updateDOM', function() {
var React;
Expand Down Expand Up @@ -220,13 +220,13 @@ describe('ReactNativeComponent', function() {
ReactDefaultInjection.inject();

var mixInto = require('mixInto');
var ReactNativeComponent = require('ReactNativeComponent');
var ReactDOMComponent = require('ReactDOMComponent');

var NodeStub = function(initialProps) {
this.props = initialProps || {};
this._rootNodeID = 'test';
};
mixInto(NodeStub, ReactNativeComponent.Mixin);
mixInto(NodeStub, ReactDOMComponent.Mixin);

genMarkup = function(props) {
return (new NodeStub(props))._createOpenTagMarkup();
Expand Down Expand Up @@ -261,14 +261,14 @@ describe('ReactNativeComponent', function() {
require('mock-modules').dumpCache();

var mixInto = require('mixInto');
var ReactNativeComponent = require('ReactNativeComponent');
var ReactDOMComponent = require('ReactDOMComponent');
var ReactReconcileTransaction = require('ReactReconcileTransaction');

var NodeStub = function(initialProps) {
this.props = initialProps || {};
this._rootNodeID = 'test';
};
mixInto(NodeStub, ReactNativeComponent.Mixin);
mixInto(NodeStub, ReactDOMComponent.Mixin);

genMarkup = function(props) {
var transaction = new ReactReconcileTransaction();
Expand Down Expand Up @@ -300,14 +300,14 @@ describe('ReactNativeComponent', function() {
var mixInto = require('mixInto');
var ReactComponent = require('ReactComponent');
var ReactMultiChild = require('ReactMultiChild');
var ReactNativeComponent = require('ReactNativeComponent');
var ReactDOMComponent = require('ReactDOMComponent');
var ReactReconcileTransaction = require('ReactReconcileTransaction');

var StubNativeComponent = function(initialProps) {
ReactComponent.Mixin.construct.call(this, initialProps);
};
mixInto(StubNativeComponent, ReactComponent.Mixin);
mixInto(StubNativeComponent, ReactNativeComponent.Mixin);
mixInto(StubNativeComponent, ReactDOMComponent.Mixin);
mixInto(StubNativeComponent, ReactMultiChild.Mixin);

mountComponent = function(props) {
Expand Down
2 changes: 1 addition & 1 deletion src/dom/components/ReactDOMButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var ReactDOM = require('ReactDOM');

var keyMirror = require('keyMirror');

// Store a reference to the <button> `ReactNativeComponent`.
// Store a reference to the <button> `ReactDOMComponent`.
var button = ReactDOM.button;

var mouseListenerNames = keyMirror({
Expand Down
2 changes: 1 addition & 1 deletion src/dom/components/ReactDOMForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var ReactDOM = require('ReactDOM');
var ReactEventEmitter = require('ReactEventEmitter');
var EventConstants = require('EventConstants');

// Store a reference to the <form> `ReactNativeComponent`.
// Store a reference to the <form> `ReactDOMComponent`.
var form = ReactDOM.form;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/dom/components/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var ReactMount = require('ReactMount');
var invariant = require('invariant');
var merge = require('merge');

// Store a reference to the <input> `ReactNativeComponent`.
// Store a reference to the <input> `ReactDOMComponent`.
var input = ReactDOM.input;

var instancesByReactID = {};
Expand Down
2 changes: 1 addition & 1 deletion src/dom/components/ReactDOMOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var ReactCompositeComponent = require('ReactCompositeComponent');
var ReactDOM = require('ReactDOM');

// Store a reference to the <option> `ReactNativeComponent`.
// Store a reference to the <option> `ReactDOMComponent`.
var option = ReactDOM.option;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/dom/components/ReactDOMSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var ReactDOM = require('ReactDOM');
var invariant = require('invariant');
var merge = require('merge');

// Store a reference to the <select> `ReactNativeComponent`.
// Store a reference to the <select> `ReactDOMComponent`.
var select = ReactDOM.select;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/dom/components/ReactDOMTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var ReactDOM = require('ReactDOM');
var invariant = require('invariant');
var merge = require('merge');

// Store a reference to the <textarea> `ReactNativeComponent`.
// Store a reference to the <textarea> `ReactDOMComponent`.
var textarea = ReactDOM.textarea;

// For quickly matching children type, to test if can be treated as content.
Expand Down Expand Up @@ -84,7 +84,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
}
var value = this.getValue();
return {
// We save the initial value so that `ReactNativeComponent` doesn't update
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
initialValue: value != null ? value : defaultValue,
value: defaultValue
Expand Down
6 changes: 3 additions & 3 deletions src/test/ReactDefaultPerf.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ if (__DEV__) {
switch (objName + '.' + fnName) {
case 'React.renderComponent':
return _renderComponentCallback;
case 'ReactNativeComponent.mountComponent':
case 'ReactNativeComponent.updateComponent':
case 'ReactDOMComponent.mountComponent':
case 'ReactDOMComponent.updateComponent':
return _nativeComponentCallback;
case 'ReactCompositeComponent.mountComponent':
case 'ReactCompositeComponent.updateComponent':
Expand Down Expand Up @@ -355,7 +355,7 @@ if (__DEV__) {
};

/**
* Callback function for ReactNativeComponent
* Callback function for ReactDOMComponent
*
* @param {object} component
* @param {object} args
Expand Down
18 changes: 9 additions & 9 deletions src/test/ReactTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ var ReactTestUtils = {
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactNativeComponent} The one match.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithClass: function(root, className) {
var all =
Expand Down Expand Up @@ -150,7 +150,7 @@ var ReactTestUtils = {
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactNativeComponent} The one match.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithTag: function(root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
Expand Down Expand Up @@ -208,9 +208,9 @@ var ReactTestUtils = {

/**
* Simulates a top level event being dispatched from a raw event that occured
* on the `ReactNativeComponent` `comp`.
* on the `ReactDOMComponent` `comp`.
* @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
* @param comp {!ReactNativeComponent}
* @param comp {!ReactDOMComponent}
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
simulateEventOnDOMComponent: function(topLevelType, comp, fakeNativeEvent) {
Expand Down Expand Up @@ -243,10 +243,10 @@ var ReactTestUtils = {
/**
* Exports:
*
* - `ReactTestUtils.Simulate.click(Element/ReactNativeComponent)`
* - `ReactTestUtils.Simulate.mouseMove(Element/ReactNativeComponent)`
* - `ReactTestUtils.Simulate.mouseIn/ReactNativeComponent)`
* - `ReactTestUtils.Simulate.mouseOut(Element/ReactNativeComponent)`
* - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.mouseIn/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.mouseOut(Element/ReactDOMComponent)`
* - ... (All keys from `EventConstants.topLevelTypes`)
*
* Note: Top level event types are a subset of the entire set of handler types
Expand Down Expand Up @@ -287,7 +287,7 @@ for (eventType in topLevelTypes) {
var convenienceName = eventType.indexOf('top') === 0 ?
eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
/**
* @param {!Element || ReactNativeComponent} domComponentOrNode
* @param {!Element || ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[convenienceName] = makeSimulator(eventType);
Expand Down

0 comments on commit f43449d

Please sign in to comment.