From cd59a69115c7aa5038195277f6bb1ccf336206c8 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Wed, 11 May 2016 23:22:59 -0700 Subject: [PATCH] Rename host-y things to be "host" not "native" (#6754) For clarity. I left "native event" as-is because there's a lot of it, it's not particularly ambiguous, and SimulateNative/nativeTouchData are public API in ReactTestUtils. (cherry picked from commit ba9b985406ff56c2dea192b119328b6096895097) --- src/isomorphic/ReactDebugTool.js | 12 +-- src/isomorphic/ReactPerf.js | 2 +- src/isomorphic/classic/class/ReactClass.js | 2 +- ...js => ReactHostOperationHistoryDevtool.js} | 10 +-- .../ReactComponentTreeDevtool-test.js | 28 +++--- .../ReactComponentTreeDevtool-test.native.js | 28 +++--- ... ReactHostOperationHistoryDevtool-test.js} | 70 +++++++-------- src/renderers/dom/ReactDOM.js | 4 +- .../dom/client/ReactDOMComponentTree.js | 40 ++++----- .../dom/client/ReactDOMTreeTraversal.js | 32 +++---- .../dom/client/ReactEventListener.js | 4 +- src/renderers/dom/client/ReactMount.js | 22 ++--- src/renderers/dom/client/findDOMNode.js | 4 +- .../dom/client/utils/DOMChildrenOperations.js | 18 ++-- .../dom/client/wrappers/DisabledInputUtils.js | 10 +-- .../dom/client/wrappers/ReactDOMButton.js | 4 +- .../dom/client/wrappers/ReactDOMInput.js | 10 +-- .../dom/client/wrappers/ReactDOMOption.js | 22 ++--- .../dom/client/wrappers/ReactDOMSelect.js | 6 +- .../dom/client/wrappers/ReactDOMTextarea.js | 8 +- .../dom/shared/CSSPropertyOperations.js | 2 +- .../dom/shared/DOMPropertyOperations.js | 6 +- src/renderers/dom/shared/ReactDOMComponent.js | 88 +++++++++---------- .../dom/shared/ReactDOMEmptyComponent.js | 20 ++--- .../dom/shared/ReactDOMTextComponent.js | 38 ++++---- .../dom/shared/ReactDefaultInjection.js | 4 +- src/renderers/dom/shared/ReactInjection.js | 4 +- .../native/ReactNativeBaseComponent.js | 10 +-- .../native/ReactNativeComponentTree.js | 10 +-- .../native/ReactNativeDefaultInjection.js | 6 +- .../native/ReactNativeTextComponent.js | 12 +-- .../native/ReactNativeTreeTraversal.js | 22 ++--- .../native/createReactNativeComponentClass.js | 4 +- src/renderers/native/findNodeHandle.js | 2 +- .../shared/fiber/ReactFiberReconciler.js | 4 +- .../shared/fiber/ReactTypesOfWork.js | 2 +- .../eventPlugins/ResponderEventPlugin.js | 10 +-- .../stack/reconciler/ReactChildReconciler.js | 4 +- .../reconciler/ReactCompositeComponent.js | 52 +++++------ ...tiveComponent.js => ReactHostComponent.js} | 14 +-- .../stack/reconciler/ReactMultiChild.js | 8 +- .../stack/reconciler/ReactReconciler.js | 16 ++-- .../reconciler/ReactSimpleEmptyComponent.js | 12 +-- .../reconciler/instantiateReactComponent.js | 8 +- src/shared/utils/ReactNodeTypes.js | 4 +- ...te.js => getHostComponentFromComposite.js} | 8 +- src/test/ReactTestUtils.js | 2 +- 47 files changed, 354 insertions(+), 354 deletions(-) rename src/isomorphic/devtools/{ReactNativeOperationHistoryDevtool.js => ReactHostOperationHistoryDevtool.js} (69%) rename src/isomorphic/devtools/__tests__/{ReactNativeOperationHistoryDevtool-test.js => ReactHostOperationHistoryDevtool-test.js} (90%) rename src/renderers/shared/stack/reconciler/{ReactNativeComponent.js => ReactHostComponent.js} (88%) rename src/shared/utils/{getNativeComponentFromComposite.js => getHostComponentFromComposite.js} (76%) diff --git a/src/isomorphic/ReactDebugTool.js b/src/isomorphic/ReactDebugTool.js index f88513b387157..63f3251847ac1 100644 --- a/src/isomorphic/ReactDebugTool.js +++ b/src/isomorphic/ReactDebugTool.js @@ -50,7 +50,7 @@ var currentTimerType = null; function clearHistory() { ReactComponentTreeDevtool.purgeUnmountedComponents(); - ReactNativeOperationHistoryDevtool.clearHistory(); + ReactHostOperationHistoryDevtool.clearHistory(); } function getTreeSnapshot(registeredIDs) { @@ -74,7 +74,7 @@ function resetMeasurements() { if (__DEV__) { var previousStartTime = currentFlushStartTime; var previousMeasurements = currentFlushMeasurements || []; - var previousOperations = ReactNativeOperationHistoryDevtool.getHistory(); + var previousOperations = ReactHostOperationHistoryDevtool.getHistory(); if (!isProfiling || currentFlushNesting === 0) { currentFlushStartTime = null; @@ -214,9 +214,9 @@ var ReactDebugTool = { onEndProcessingChildContext() { emitEvent('onEndProcessingChildContext'); }, - onNativeOperation(debugID, type, payload) { + onHostOperation(debugID, type, payload) { checkDebugID(debugID); - emitEvent('onNativeOperation', debugID, type, payload); + emitEvent('onHostOperation', debugID, type, payload); }, onSetState() { emitEvent('onSetState'); @@ -260,11 +260,11 @@ var ReactDebugTool = { if (__DEV__) { var ReactInvalidSetStateWarningDevTool = require('ReactInvalidSetStateWarningDevTool'); - var ReactNativeOperationHistoryDevtool = require('ReactNativeOperationHistoryDevtool'); + var ReactHostOperationHistoryDevtool = require('ReactHostOperationHistoryDevtool'); var ReactComponentTreeDevtool = require('ReactComponentTreeDevtool'); ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool); ReactDebugTool.addDevtool(ReactComponentTreeDevtool); - ReactDebugTool.addDevtool(ReactNativeOperationHistoryDevtool); + ReactDebugTool.addDevtool(ReactHostOperationHistoryDevtool); var url = (ExecutionEnvironment.canUseDOM && window.location.href) || ''; if ((/[?&]react_perf\b/).test(url)) { ReactDebugTool.beginProfiling(); diff --git a/src/isomorphic/ReactPerf.js b/src/isomorphic/ReactPerf.js index 4c631a7f13e45..01f1aee388807 100644 --- a/src/isomorphic/ReactPerf.js +++ b/src/isomorphic/ReactPerf.js @@ -167,7 +167,7 @@ function getWasted(flushHistory = getFlushHistory()) { var {measurements, treeSnapshot, operations} = flush; var isDefinitelyNotWastedByID = {}; - // Find native components associated with an operation in this batch. + // Find host components associated with an operation in this batch. // Mark all components in their parent tree as definitely not wasted. operations.forEach(operation => { var {instanceID} = operation; diff --git a/src/isomorphic/classic/class/ReactClass.js b/src/isomorphic/classic/class/ReactClass.js index fe82510b89820..01bd6df5871b1 100644 --- a/src/isomorphic/classic/class/ReactClass.js +++ b/src/isomorphic/classic/class/ReactClass.js @@ -55,7 +55,7 @@ var injectedMixins = []; /** * Composite components are higher-level components that compose other composite - * or native components. + * or host components. * * To create a new type of `ReactClass`, pass a specification of * your new class to `React.createClass`. The only requirement of your class diff --git a/src/isomorphic/devtools/ReactNativeOperationHistoryDevtool.js b/src/isomorphic/devtools/ReactHostOperationHistoryDevtool.js similarity index 69% rename from src/isomorphic/devtools/ReactNativeOperationHistoryDevtool.js rename to src/isomorphic/devtools/ReactHostOperationHistoryDevtool.js index 46b8194465db2..475f1bace88de 100644 --- a/src/isomorphic/devtools/ReactNativeOperationHistoryDevtool.js +++ b/src/isomorphic/devtools/ReactHostOperationHistoryDevtool.js @@ -6,15 +6,15 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule ReactNativeOperationHistoryDevtool + * @providesModule ReactHostOperationHistoryDevtool */ 'use strict'; var history = []; -var ReactNativeOperationHistoryDevtool = { - onNativeOperation(debugID, type, payload) { +var ReactHostOperationHistoryDevtool = { + onHostOperation(debugID, type, payload) { history.push({ instanceID: debugID, type, @@ -23,7 +23,7 @@ var ReactNativeOperationHistoryDevtool = { }, clearHistory() { - if (ReactNativeOperationHistoryDevtool._preventClearing) { + if (ReactHostOperationHistoryDevtool._preventClearing) { // Should only be used for tests. return; } @@ -36,4 +36,4 @@ var ReactNativeOperationHistoryDevtool = { }, }; -module.exports = ReactNativeOperationHistoryDevtool; +module.exports = ReactHostOperationHistoryDevtool; diff --git a/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.js b/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.js index 1c5cdb7049ab0..a600c79e59684 100644 --- a/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.js +++ b/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.js @@ -289,7 +289,7 @@ describe('ReactComponentTreeDevtool', () => { assertTreeMatches([element, tree]); }); - it('reports a native tree correctly', () => { + it('reports a host tree correctly', () => { var element = (

@@ -532,7 +532,7 @@ describe('ReactComponentTreeDevtool', () => { }); describe('update', () => { - describe('native component', () => { + describe('host component', () => { it('updates text of a single text child', () => { var elementBefore =

Hi.
; var treeBefore = { @@ -869,7 +869,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates native nodes when reordering with keys', () => { + it('updates host nodes when reordering with keys', () => { var elementBefore = (
Hi.
@@ -922,7 +922,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates native nodes when reordering without keys', () => { + it('updates host nodes when reordering without keys', () => { var elementBefore = (
Hi.
@@ -1172,7 +1172,7 @@ describe('ReactComponentTreeDevtool', () => { }); describe('functional component', () => { - it('updates with a native child', () => { + it('updates with a host child', () => { function Foo({ children }) { return children; } @@ -1201,7 +1201,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from null to a native child', () => { + it('updates from null to a host child', () => { function Foo({ children }) { return children; } @@ -1227,7 +1227,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to null', () => { + it('updates from a host child to null', () => { function Foo({ children }) { return children; } @@ -1253,7 +1253,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to a composite child', () => { + it('updates from a host child to a composite child', () => { function Bar() { return null; } @@ -1286,7 +1286,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a composite child to a native child', () => { + it('updates from a composite child to a host child', () => { function Bar() { return null; } @@ -1381,7 +1381,7 @@ describe('ReactComponentTreeDevtool', () => { }); describe('class component', () => { - it('updates with a native child', () => { + it('updates with a host child', () => { var Foo = React.createClass({ render() { return this.props.children; @@ -1412,7 +1412,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from null to a native child', () => { + it('updates from null to a host child', () => { var Foo = React.createClass({ render() { return this.props.children; @@ -1440,7 +1440,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to null', () => { + it('updates from a host child to null', () => { var Foo = React.createClass({ render() { return this.props.children; @@ -1468,7 +1468,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to a composite child', () => { + it('updates from a host child to a composite child', () => { var Bar = React.createClass({ render() { return null; @@ -1505,7 +1505,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a composite child to a native child', () => { + it('updates from a composite child to a host child', () => { var Bar = React.createClass({ render() { return null; diff --git a/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.native.js b/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.native.js index f3b026b459ccf..6841cbd0c62e0 100644 --- a/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.native.js +++ b/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.native.js @@ -300,7 +300,7 @@ describe('ReactComponentTreeDevtool', () => { assertTreeMatches([element, tree]); }); - it('reports a native tree correctly', () => { + it('reports a host tree correctly', () => { var element = ( @@ -540,7 +540,7 @@ describe('ReactComponentTreeDevtool', () => { }); describe('update', () => { - describe('native component', () => { + describe('host component', () => { it('updates text of a single text child', () => { var elementBefore = Hi.; var treeBefore = { @@ -792,7 +792,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates native nodes when reordering with keys', () => { + it('updates host nodes when reordering with keys', () => { var elementBefore = ( Hi. @@ -857,7 +857,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates native nodes when reordering with keys', () => { + it('updates host nodes when reordering with keys', () => { var elementBefore = ( Hi. @@ -1137,7 +1137,7 @@ describe('ReactComponentTreeDevtool', () => { }); describe('functional component', () => { - it('updates with a native child', () => { + it('updates with a host child', () => { function Foo({ children }) { return children; } @@ -1166,7 +1166,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from null to a native child', () => { + it('updates from null to a host child', () => { function Foo({ children }) { return children; } @@ -1192,7 +1192,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to null', () => { + it('updates from a host child to null', () => { function Foo({ children }) { return children; } @@ -1218,7 +1218,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to a composite child', () => { + it('updates from a host child to a composite child', () => { function Bar() { return null; } @@ -1251,7 +1251,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a composite child to a native child', () => { + it('updates from a composite child to a host child', () => { function Bar() { return null; } @@ -1346,7 +1346,7 @@ describe('ReactComponentTreeDevtool', () => { }); describe('class component', () => { - it('updates with a native child', () => { + it('updates with a host child', () => { var Foo = React.createClass({ render() { return this.props.children; @@ -1377,7 +1377,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from null to a native child', () => { + it('updates from null to a host child', () => { var Foo = React.createClass({ render() { return this.props.children; @@ -1405,7 +1405,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to null', () => { + it('updates from a host child to null', () => { var Foo = React.createClass({ render() { return this.props.children; @@ -1433,7 +1433,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a native child to a composite child', () => { + it('updates from a host child to a composite child', () => { var Bar = React.createClass({ render() { return null; @@ -1470,7 +1470,7 @@ describe('ReactComponentTreeDevtool', () => { ]); }); - it('updates from a composite child to a native child', () => { + it('updates from a composite child to a host child', () => { var Bar = React.createClass({ render() { return null; diff --git a/src/isomorphic/devtools/__tests__/ReactNativeOperationHistoryDevtool-test.js b/src/isomorphic/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js similarity index 90% rename from src/isomorphic/devtools/__tests__/ReactNativeOperationHistoryDevtool-test.js rename to src/isomorphic/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js index 769fe675b1edc..11638f3eda9aa 100644 --- a/src/isomorphic/devtools/__tests__/ReactNativeOperationHistoryDevtool-test.js +++ b/src/isomorphic/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js @@ -11,12 +11,12 @@ 'use strict'; -describe('ReactNativeOperationHistoryDevtool', () => { +describe('ReactHostOperationHistoryDevtool', () => { var React; var ReactDOM; var ReactDOMComponentTree; var ReactDOMFeatureFlags; - var ReactNativeOperationHistoryDevtool; + var ReactHostOperationHistoryDevtool; beforeEach(() => { jest.resetModuleRegistry(); @@ -25,18 +25,18 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM = require('ReactDOM'); ReactDOMComponentTree = require('ReactDOMComponentTree'); ReactDOMFeatureFlags = require('ReactDOMFeatureFlags'); - ReactNativeOperationHistoryDevtool = require('ReactNativeOperationHistoryDevtool'); + ReactHostOperationHistoryDevtool = require('ReactHostOperationHistoryDevtool'); }); function assertHistoryMatches(expectedHistory) { - var actualHistory = ReactNativeOperationHistoryDevtool.getHistory(); + var actualHistory = ReactHostOperationHistoryDevtool.getHistory(); expect(actualHistory).toEqual(expectedHistory); } describe('mount', () => { - it('gets recorded for native roots', () => { + it('gets recorded for host roots', () => { var node = document.createElement('div'); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(

Hi.

, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); @@ -55,7 +55,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { } var node = document.createElement('div'); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); @@ -75,7 +75,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { } var node = document.createElement('div'); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(, node); // Empty DOM components should be invisible to devtools. @@ -88,7 +88,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { return element; } - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; var node = document.createElement('div'); element = null; @@ -112,7 +112,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { it('gets recorded during mount', () => { var node = document.createElement('div'); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
{ ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node); ReactDOM.render(
{ ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
{ it('gets recorded during mount', () => { var node = document.createElement('div'); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); @@ -239,7 +239,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node); ReactDOM.render(
, node); ReactDOM.render(
, node); @@ -274,7 +274,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node); ReactDOM.render(
, node); @@ -294,7 +294,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { it('gets recorded during mount', () => { var node = document.createElement('div'); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); @@ -327,7 +327,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node); ReactDOM.render(
, node); ReactDOM.render(
, node); @@ -360,7 +360,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { it('gets recorded during mount', () => { var node = document.createElement('div'); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); @@ -393,7 +393,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(, node); ReactDOM.render(, node); ReactDOM.render(, node); @@ -430,7 +430,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(
Hi.
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
Bye.
, node); assertHistoryMatches([{ @@ -445,7 +445,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
Bye.
, node); assertHistoryMatches([{ @@ -460,7 +460,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(

, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
Bye.
, node); assertHistoryMatches([{ @@ -482,7 +482,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { var node = document.createElement('div'); ReactDOM.render(
Hi.
, node); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
Hi.
, node); assertHistoryMatches([]); @@ -496,7 +496,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { var inst1 = ReactDOMComponentTree.getInstanceFromNode(node.firstChild.childNodes[0]); var inst2 = ReactDOMComponentTree.getInstanceFromNode(node.firstChild.childNodes[3]); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
{'Bye.'}{43}
, node); assertHistoryMatches([{ @@ -514,7 +514,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { var node = document.createElement('div'); ReactDOM.render(
{'Hi.'}{42}
, node); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
{'Hi.'}{42}
, node); assertHistoryMatches([]); @@ -536,7 +536,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { element = ; - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(, node); assertHistoryMatches([{ @@ -559,7 +559,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); element = null; - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(, node); assertHistoryMatches([{ @@ -581,7 +581,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { element =
; - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(, node); assertHistoryMatches([]); @@ -594,7 +594,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(
Hi.
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node @@ -615,7 +615,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node @@ -633,7 +633,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(

, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node @@ -661,7 +661,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { node ); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node @@ -677,7 +677,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(
, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(

, node); assertHistoryMatches([{ @@ -694,7 +694,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(

, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(

, node); assertHistoryMatches([{ @@ -711,7 +711,7 @@ describe('ReactNativeOperationHistoryDevtool', () => { ReactDOM.render(

, node); var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild); - ReactNativeOperationHistoryDevtool._preventClearing = true; + ReactHostOperationHistoryDevtool._preventClearing = true; ReactDOM.render(
, node); assertHistoryMatches([{ diff --git a/src/renderers/dom/ReactDOM.js b/src/renderers/dom/ReactDOM.js index 7e7fbe46397de..1619bfd4d42d5 100644 --- a/src/renderers/dom/ReactDOM.js +++ b/src/renderers/dom/ReactDOM.js @@ -21,7 +21,7 @@ var ReactUpdates = require('ReactUpdates'); var ReactVersion = require('ReactVersion'); var findDOMNode = require('findDOMNode'); -var getNativeComponentFromComposite = require('getNativeComponentFromComposite'); +var getHostComponentFromComposite = require('getHostComponentFromComposite'); var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer'); var warning = require('warning'); @@ -51,7 +51,7 @@ if ( getNodeFromInstance: function(inst) { // inst is an internal instance (but could be a composite) if (inst._renderedComponent) { - inst = getNativeComponentFromComposite(inst); + inst = getHostComponentFromComposite(inst); } if (inst) { return ReactDOMComponentTree.getNodeFromInstance(inst); diff --git a/src/renderers/dom/client/ReactDOMComponentTree.js b/src/renderers/dom/client/ReactDOMComponentTree.js index ec95b26c6322d..4d9b8315c853c 100644 --- a/src/renderers/dom/client/ReactDOMComponentTree.js +++ b/src/renderers/dom/client/ReactDOMComponentTree.js @@ -23,13 +23,13 @@ var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); /** - * Drill down (through composites and empty components) until we get a native or - * native text component. + * Drill down (through composites and empty components) until we get a host or + * host text component. * * This is pretty polymorphic but unavoidable with the current structure we have * for `_renderedChildren`. */ -function getRenderedNativeOrTextFromComponent(component) { +function getRenderedHostOrTextFromComponent(component) { var rendered; while ((rendered = component._renderedComponent)) { component = rendered; @@ -38,25 +38,25 @@ function getRenderedNativeOrTextFromComponent(component) { } /** - * Populate `_nativeNode` on the rendered native/text component with the given + * Populate `_hostNode` on the rendered host/text component with the given * DOM node. The passed `inst` can be a composite. */ function precacheNode(inst, node) { - var nativeInst = getRenderedNativeOrTextFromComponent(inst); - nativeInst._nativeNode = node; - node[internalInstanceKey] = nativeInst; + var hostInst = getRenderedHostOrTextFromComponent(inst); + hostInst._hostNode = node; + node[internalInstanceKey] = hostInst; } function uncacheNode(inst) { - var node = inst._nativeNode; + var node = inst._hostNode; if (node) { delete node[internalInstanceKey]; - inst._nativeNode = null; + inst._hostNode = null; } } /** - * Populate `_nativeNode` on each child of `inst`, assuming that the children + * Populate `_hostNode` on each child of `inst`, assuming that the children * match up with the DOM (element) children of `node`. * * We cache entire levels at once to avoid an n^2 problem where we access the @@ -80,7 +80,7 @@ function precacheChildNodes(inst, node) { continue; } var childInst = children[name]; - var childID = getRenderedNativeOrTextFromComponent(childInst)._domID; + var childID = getRenderedHostOrTextFromComponent(childInst)._domID; if (childID == null) { // We're currently unmounting this child in ReactMultiChild; skip it. continue; @@ -143,7 +143,7 @@ function getClosestInstanceFromNode(node) { */ function getInstanceFromNode(node) { var inst = getClosestInstanceFromNode(node); - if (inst != null && inst._nativeNode === node) { + if (inst != null && inst._hostNode === node) { return inst; } else { return null; @@ -158,32 +158,32 @@ function getNodeFromInstance(inst) { // Without this first invariant, passing a non-DOM-component triggers the next // invariant for a missing parent, which is super confusing. invariant( - inst._nativeNode !== undefined, + inst._hostNode !== undefined, 'getNodeFromInstance: Invalid argument.' ); - if (inst._nativeNode) { - return inst._nativeNode; + if (inst._hostNode) { + return inst._hostNode; } // Walk up the tree until we find an ancestor whose DOM node we have cached. var parents = []; - while (!inst._nativeNode) { + while (!inst._hostNode) { parents.push(inst); invariant( - inst._nativeParent, + inst._hostParent, 'React DOM tree root should always have a node reference.' ); - inst = inst._nativeParent; + inst = inst._hostParent; } // Now parents contains each ancestor that does *not* have a cached native // node, and `inst` is the deepest ancestor that does. for (; parents.length; inst = parents.pop()) { - precacheChildNodes(inst, inst._nativeNode); + precacheChildNodes(inst, inst._hostNode); } - return inst._nativeNode; + return inst._hostNode; } var ReactDOMComponentTree = { diff --git a/src/renderers/dom/client/ReactDOMTreeTraversal.js b/src/renderers/dom/client/ReactDOMTreeTraversal.js index c4767736bb567..9cbc39f3a2a44 100644 --- a/src/renderers/dom/client/ReactDOMTreeTraversal.js +++ b/src/renderers/dom/client/ReactDOMTreeTraversal.js @@ -18,27 +18,27 @@ var invariant = require('invariant'); * different trees. */ function getLowestCommonAncestor(instA, instB) { - invariant('_nativeNode' in instA, 'getNodeFromInstance: Invalid argument.'); - invariant('_nativeNode' in instB, 'getNodeFromInstance: Invalid argument.'); + invariant('_hostNode' in instA, 'getNodeFromInstance: Invalid argument.'); + invariant('_hostNode' in instB, 'getNodeFromInstance: Invalid argument.'); var depthA = 0; - for (var tempA = instA; tempA; tempA = tempA._nativeParent) { + for (var tempA = instA; tempA; tempA = tempA._hostParent) { depthA++; } var depthB = 0; - for (var tempB = instB; tempB; tempB = tempB._nativeParent) { + for (var tempB = instB; tempB; tempB = tempB._hostParent) { depthB++; } // If A is deeper, crawl up. while (depthA - depthB > 0) { - instA = instA._nativeParent; + instA = instA._hostParent; depthA--; } // If B is deeper, crawl up. while (depthB - depthA > 0) { - instB = instB._nativeParent; + instB = instB._hostParent; depthB--; } @@ -48,8 +48,8 @@ function getLowestCommonAncestor(instA, instB) { if (instA === instB) { return instA; } - instA = instA._nativeParent; - instB = instB._nativeParent; + instA = instA._hostParent; + instB = instB._hostParent; } return null; } @@ -58,14 +58,14 @@ function getLowestCommonAncestor(instA, instB) { * Return if A is an ancestor of B. */ function isAncestor(instA, instB) { - invariant('_nativeNode' in instA, 'isAncestor: Invalid argument.'); - invariant('_nativeNode' in instB, 'isAncestor: Invalid argument.'); + invariant('_hostNode' in instA, 'isAncestor: Invalid argument.'); + invariant('_hostNode' in instB, 'isAncestor: Invalid argument.'); while (instB) { if (instB === instA) { return true; } - instB = instB._nativeParent; + instB = instB._hostParent; } return false; } @@ -74,9 +74,9 @@ function isAncestor(instA, instB) { * Return the parent instance of the passed-in instance. */ function getParentInstance(inst) { - invariant('_nativeNode' in inst, 'getParentInstance: Invalid argument.'); + invariant('_hostNode' in inst, 'getParentInstance: Invalid argument.'); - return inst._nativeParent; + return inst._hostParent; } /** @@ -86,7 +86,7 @@ function traverseTwoPhase(inst, fn, arg) { var path = []; while (inst) { path.push(inst); - inst = inst._nativeParent; + inst = inst._hostParent; } var i; for (i = path.length; i-- > 0;) { @@ -109,12 +109,12 @@ function traverseEnterLeave(from, to, fn, argFrom, argTo) { var pathFrom = []; while (from && from !== common) { pathFrom.push(from); - from = from._nativeParent; + from = from._hostParent; } var pathTo = []; while (to && to !== common) { pathTo.push(to); - to = to._nativeParent; + to = to._hostParent; } var i; for (i = 0; i < pathFrom.length; i++) { diff --git a/src/renderers/dom/client/ReactEventListener.js b/src/renderers/dom/client/ReactEventListener.js index bbdbbcf29115e..be78b7c131188 100644 --- a/src/renderers/dom/client/ReactEventListener.js +++ b/src/renderers/dom/client/ReactEventListener.js @@ -29,8 +29,8 @@ function findParent(inst) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. - while (inst._nativeParent) { - inst = inst._nativeParent; + while (inst._hostParent) { + inst = inst._hostParent; } var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst); var container = rootNode.parentNode; diff --git a/src/renderers/dom/client/ReactMount.js b/src/renderers/dom/client/ReactMount.js index 6ec60a21fa910..4f45156704e0c 100644 --- a/src/renderers/dom/client/ReactMount.js +++ b/src/renderers/dom/client/ReactMount.js @@ -195,23 +195,23 @@ function hasNonRootReactChild(container) { var rootEl = getReactRootElementInContainer(container); if (rootEl) { var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); - return !!(inst && inst._nativeParent); + return !!(inst && inst._hostParent); } } -function getNativeRootInstanceInContainer(container) { +function getHostRootInstanceInContainer(container) { var rootEl = getReactRootElementInContainer(container); - var prevNativeInstance = + var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); return ( - prevNativeInstance && !prevNativeInstance._nativeParent ? - prevNativeInstance : null + prevHostInstance && !prevHostInstance._hostParent ? + prevHostInstance : null ); } function getTopLevelWrapperInContainer(container) { - var root = getNativeRootInstanceInContainer(container); - return root ? root._nativeContainerInfo._topLevelWrapper : null; + var root = getHostRootInstanceInContainer(container); + return root ? root._hostContainerInfo._topLevelWrapper : null; } /** @@ -701,10 +701,10 @@ var ReactMount = { } if (__DEV__) { - var nativeNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); - if (nativeNode._debugID !== 0) { - ReactInstrumentation.debugTool.onNativeOperation( - nativeNode._debugID, + var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); + if (hostNode._debugID !== 0) { + ReactInstrumentation.debugTool.onHostOperation( + hostNode._debugID, 'mount', markup.toString() ); diff --git a/src/renderers/dom/client/findDOMNode.js b/src/renderers/dom/client/findDOMNode.js index 9c2a3b9ea5e74..238b5938d472f 100644 --- a/src/renderers/dom/client/findDOMNode.js +++ b/src/renderers/dom/client/findDOMNode.js @@ -15,7 +15,7 @@ var ReactCurrentOwner = require('ReactCurrentOwner'); var ReactDOMComponentTree = require('ReactDOMComponentTree'); var ReactInstanceMap = require('ReactInstanceMap'); -var getNativeComponentFromComposite = require('getNativeComponentFromComposite'); +var getHostComponentFromComposite = require('getHostComponentFromComposite'); var invariant = require('invariant'); var warning = require('warning'); @@ -52,7 +52,7 @@ function findDOMNode(componentOrElement) { var inst = ReactInstanceMap.get(componentOrElement); if (inst) { - inst = getNativeComponentFromComposite(inst); + inst = getHostComponentFromComposite(inst); return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null; } diff --git a/src/renderers/dom/client/utils/DOMChildrenOperations.js b/src/renderers/dom/client/utils/DOMChildrenOperations.js index 4f0da4b7cce90..a4541646d1900 100644 --- a/src/renderers/dom/client/utils/DOMChildrenOperations.js +++ b/src/renderers/dom/client/utils/DOMChildrenOperations.js @@ -23,7 +23,7 @@ var setTextContent = require('setTextContent'); function getNodeAfter(parentNode, node) { // Special case for text components, which return [open, close] comments - // from getNativeNode. + // from getHostNode. if (Array.isArray(node)) { node = node[1]; } @@ -123,7 +123,7 @@ function replaceDelimitedText(openingComment, closingComment, stringText) { } if (__DEV__) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, 'replace text', stringText @@ -136,7 +136,7 @@ if (__DEV__) { dangerouslyReplaceNodeWithMarkup = function(oldChild, markup, prevInstance) { Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); if (prevInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( prevInstance._debugID, 'replace with', markup.toString() @@ -144,7 +144,7 @@ if (__DEV__) { } else { var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); if (nextInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( nextInstance._debugID, 'mount', markup.toString() @@ -186,7 +186,7 @@ var DOMChildrenOperations = { getNodeAfter(parentNode, update.afterNode) ); if (__DEV__) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( parentNodeDebugID, 'insert child', {toIndex: update.toIndex, content: update.content.toString()} @@ -200,7 +200,7 @@ var DOMChildrenOperations = { getNodeAfter(parentNode, update.afterNode) ); if (__DEV__) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( parentNodeDebugID, 'move child', {fromIndex: update.fromIndex, toIndex: update.toIndex} @@ -213,7 +213,7 @@ var DOMChildrenOperations = { update.content ); if (__DEV__) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( parentNodeDebugID, 'replace children', update.content.toString() @@ -226,7 +226,7 @@ var DOMChildrenOperations = { update.content ); if (__DEV__) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( parentNodeDebugID, 'replace text', update.content.toString() @@ -236,7 +236,7 @@ var DOMChildrenOperations = { case ReactMultiChildUpdateTypes.REMOVE_NODE: removeChild(parentNode, update.fromNode); if (__DEV__) { - ReactInstrumentation.debugTool.onNativeOperation( + ReactInstrumentation.debugTool.onHostOperation( parentNodeDebugID, 'remove child', {fromIndex: update.fromIndex} diff --git a/src/renderers/dom/client/wrappers/DisabledInputUtils.js b/src/renderers/dom/client/wrappers/DisabledInputUtils.js index 37f80283514b8..1393a14b4e80e 100644 --- a/src/renderers/dom/client/wrappers/DisabledInputUtils.js +++ b/src/renderers/dom/client/wrappers/DisabledInputUtils.js @@ -26,24 +26,24 @@ var disableableMouseListenerNames = { }; /** - * Implements a native component that does not receive mouse events + * Implements a host component that does not receive mouse events * when `disabled` is set. */ var DisabledInputUtils = { - getNativeProps: function(inst, props) { + getHostProps: function(inst, props) { if (!props.disabled) { return props; } // Copy the props, except the mouse listeners - var nativeProps = {}; + var hostProps = {}; for (var key in props) { if (!disableableMouseListenerNames[key] && props.hasOwnProperty(key)) { - nativeProps[key] = props[key]; + hostProps[key] = props[key]; } } - return nativeProps; + return hostProps; }, }; diff --git a/src/renderers/dom/client/wrappers/ReactDOMButton.js b/src/renderers/dom/client/wrappers/ReactDOMButton.js index 961a1ebebcf2b..09879c9397a66 100644 --- a/src/renderers/dom/client/wrappers/ReactDOMButton.js +++ b/src/renderers/dom/client/wrappers/ReactDOMButton.js @@ -14,11 +14,11 @@ var DisabledInputUtils = require('DisabledInputUtils'); /** - * Implements a