move getReactRootElementInContainer to ReactMount.js
getReactRootElementInContainer.js file contains one function used only in ReactMount.js.
Mert Kahyaoğlu committed
Mar 20, 2015 at 20:50 UTC
63aa7259b9f48886af545afcc06c29acf225b05f
2 files changed
+17
-34
src/browser/ui/ReactMount.js
+17
-1
@@ -27,7 +27,6 @@ var ReactUpdates = require('ReactUpdates');
27
28
var emptyObject = require('emptyObject');
29
var containsNode = require('containsNode');
30
-var getReactRootElementInContainer = require('getReactRootElementInContainer');
30
var instantiateReactComponent = require('instantiateReactComponent');
31
var invariant = require('invariant');
32
var setInnerHTML = require('setInnerHTML');
@@ -73,6 +72,23 @@ function firstDifferenceIndex(string1, string2) {
72
return string1.length === string2.length ? -1 : minLen;
73
}
74
75
+/**
76
+ * @param {DOMElement|DOMDocument} container DOM element that may contain
77
+ * a React component
78
+ * @return {?*} DOM element that may have the reactRoot ID, or null.
79
+ */
80
+function getReactRootElementInContainer(container) {
81
+ if (!container) {
82
+ return null;
83
+ }
84
+
85
+ if (container.nodeType === DOC_NODE_TYPE) {
86
+ return container.documentElement;
87
+ } else {
88
+ return container.firstChild;
89
+ }
90
+}
91
+
92
/**
93
* @param {DOMElement} container DOM element that may contain a React component.
94
* @return {?string} A "reactRoot" ID, if a React component is rendered.
src/browser/ui/getReactRootElementInContainer.js
deleted
-33
@@ -1,33 +0,0 @@
1
-/**
2
- * Copyright 2013-2015, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule getReactRootElementInContainer
10
- */
11
-
12
-'use strict';
13
-
14
-var DOC_NODE_TYPE = 9;
15
-
16
-/**
17
- * @param {DOMElement|DOMDocument} container DOM element that may contain
18
- * a React component
19
- * @return {?*} DOM element that may have the reactRoot ID, or null.
20
- */
21
-function getReactRootElementInContainer(container) {
22
- if (!container) {
23
- return null;
24
- }
25
-
26
- if (container.nodeType === DOC_NODE_TYPE) {
27
- return container.documentElement;
28
- } else {
29
- return container.firstChild;
30
- }
31
-}
32
-
33
-module.exports = getReactRootElementInContainer;