Revert "Warn when multiple instances of React are loaded on the same page"
Ben Alpert committed
Apr 10, 2015 at 12:34 UTC
8fa15080b2eafa0ab998f0e3745971af40e13e69
2 files changed
+5
-26
grunt/tasks/version-check.js
+1
-1
@@ -6,7 +6,7 @@ var grunt = require('grunt');
6
// Check that the version we're exporting is the same one we expect in the
7
// package. This is not an ideal way to do this, but makes sure that we keep
8
// them in sync.
9
-var reactVersionExp = /\bREACT_VERSION\s*=\s*['"]([^'"]+)['"];/;
9
+var reactVersionExp = /\bReact\.version\s*=\s*['"]([^'"]+)['"];/;
10
11
module.exports = function() {
12
var reactVersion = reactVersionExp.exec(
src/browser/ui/React.js
+4
-25
@@ -13,30 +13,6 @@
13
14
'use strict';
15
16
-var REACT_VERSION = '0.14.0-alpha';
17
-
18
-var ExecutionEnvironment = require('ExecutionEnvironment');
19
-var warning = require('warning');
20
-
21
-if (__DEV__) {
22
- // before performing any initialization of React, check that
23
- // only one instance is in use on the current page.
24
- //
25
- // Using multiple instances cause a variety of problems if elements
26
- // from different versions are mixed on the same page.
27
- //
28
- // See issue #2402
29
- if (ExecutionEnvironment.canUseDOM) {
30
- warning(
31
- typeof window.__REACT_VERSION__ === 'undefined',
32
- 'Multiple instances of React have been initialized on the same page. ' +
33
- 'Currently initializing React v' + REACT_VERSION + ' but another instance of React v' +
34
- window.__REACT_VERSION__ + ' was already initialized'
35
- );
36
- window.__REACT_VERSION__ = REACT_VERSION;
37
- }
38
-}
39
-
16
var ReactChildren = require('ReactChildren');
17
var ReactComponent = require('ReactComponent');
18
var ReactClass = require('ReactClass');
@@ -57,6 +33,7 @@ var ReactServerRendering = require('ReactServerRendering');
33
var assign = require('Object.assign');
34
var findDOMNode = require('findDOMNode');
35
var onlyChild = require('onlyChild');
36
+var warning = require('warning');
37
38
ReactDefaultInjection.inject();
39
@@ -73,7 +50,6 @@ if (__DEV__) {
50
var render = ReactPerf.measure('React', 'render', ReactMount.render);
51
52
var React = {
76
- version: REACT_VERSION,
53
Children: {
54
map: ReactChildren.map,
55
forEach: ReactChildren.forEach,
@@ -120,6 +96,7 @@ if (
96
}
97
98
if (__DEV__) {
99
+ var ExecutionEnvironment = require('ExecutionEnvironment');
100
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
101
102
// If we're in Chrome, look for the devtools marker and provide a download
@@ -175,4 +152,6 @@ if (__DEV__) {
152
}
153
}
154
155
+React.version = '0.14.0-alpha';
156
+
157
module.exports = React;