react 0.14.0-beta3 → 0.14.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addons.js +2 -0
- package/dist/react-dom.js +42 -0
- package/dist/react-dom.min.js +12 -0
- package/dist/react-with-addons.js +1587 -1228
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1407 -1154
- package/dist/react.min.js +6 -6
- package/lib/CSSProperty.js +15 -3
- package/lib/CSSPropertyOperations.js +9 -1
- package/lib/ChangeEventPlugin.js +2 -1
- package/lib/DOMChildrenOperations.js +7 -1
- package/lib/DOMPropertyOperations.js +7 -1
- package/lib/Danger.js +9 -4
- package/lib/EnterLeaveEventPlugin.js +13 -5
- package/lib/EventConstants.js +1 -1
- package/lib/EventPluginHub.js +4 -7
- package/lib/EventPluginUtils.js +18 -27
- package/lib/EventPropagators.js +1 -1
- package/lib/FallbackCompositionState.js +6 -0
- package/lib/HTMLDOMPropertyConfig.js +7 -0
- package/lib/PooledClass.js +1 -3
- package/lib/React.js +14 -3
- package/lib/ReactBrowserComponentMixin.js +1 -1
- package/lib/ReactBrowserEventEmitter.js +3 -3
- package/lib/ReactCSSTransitionGroup.js +33 -18
- package/lib/ReactCSSTransitionGroupChild.js +42 -25
- package/lib/ReactChildReconciler.js +3 -5
- package/lib/ReactChildren.js +70 -30
- package/lib/ReactClass.js +7 -6
- package/lib/ReactComponent.js +5 -3
- package/lib/ReactCompositeComponent.js +44 -6
- package/lib/ReactDOM.js +7 -5
- package/lib/ReactDOMComponent.js +73 -26
- package/lib/ReactDOMFeatureFlags.js +18 -0
- package/lib/ReactDOMIDOperations.js +1 -59
- package/lib/ReactDOMInput.js +4 -0
- package/lib/ReactDOMSelect.js +1 -1
- package/lib/ReactDOMServer.js +3 -1
- package/lib/ReactDOMTextComponent.js +23 -10
- package/lib/ReactDefaultInjection.js +0 -2
- package/lib/ReactDefaultPerfAnalysis.js +0 -2
- package/lib/ReactElement.js +81 -35
- package/lib/ReactElementValidator.js +17 -68
- package/lib/ReactEmptyComponent.js +25 -61
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +44 -8
- package/lib/ReactEventListener.js +16 -9
- package/lib/ReactFragment.js +25 -116
- package/lib/ReactInjection.js +0 -2
- package/lib/ReactIsomorphic.js +4 -0
- package/lib/ReactMount.js +114 -40
- package/lib/ReactMultiChild.js +37 -4
- package/lib/ReactOwner.js +2 -2
- package/lib/ReactPropTypes.js +11 -8
- package/lib/ReactReconcileTransaction.js +4 -2
- package/lib/ReactReconciler.js +16 -17
- package/lib/ReactRef.js +14 -1
- package/lib/ReactServerRenderingTransaction.js +1 -0
- package/lib/ReactTestUtils.js +11 -8
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactUpdateQueue.js +4 -4
- package/lib/ReactUpdates.js +1 -1
- package/lib/ReactVersion.js +14 -0
- package/lib/ReactWithAddons.js +10 -1
- package/lib/ResponderEventPlugin.js +1 -1
- package/lib/SelectEventPlugin.js +11 -1
- package/lib/SimpleEventPlugin.js +2 -23
- package/lib/SyntheticEvent.js +15 -0
- package/lib/Transaction.js +1 -1
- package/lib/deprecated.js +3 -2
- package/lib/findDOMNode.js +1 -1
- package/lib/instantiateReactComponent.js +3 -5
- package/lib/reactComponentExpect.js +6 -0
- package/lib/shouldUpdateReactComponent.js +12 -8
- package/lib/sliceChildren.js +3 -20
- package/lib/traverseAllChildren.js +10 -9
- package/package.json +2 -2
- package/react.js +1 -51
- package/dist/JSXTransformer.js +0 -17949
|
@@ -12,76 +12,40 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactElement = require('./ReactElement');
|
|
15
|
-
var
|
|
15
|
+
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
|
|
16
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
16
17
|
|
|
17
|
-
var
|
|
18
|
+
var assign = require('./Object.assign');
|
|
18
19
|
|
|
19
|
-
var
|
|
20
|
-
// This registry keeps track of the React IDs of the components that rendered to
|
|
21
|
-
// `null` (in reality a placeholder such as `noscript`)
|
|
22
|
-
var nullComponentIDsRegistry = {};
|
|
20
|
+
var placeholderElement;
|
|
23
21
|
|
|
24
22
|
var ReactEmptyComponentInjection = {
|
|
25
|
-
injectEmptyComponent: function (
|
|
26
|
-
|
|
23
|
+
injectEmptyComponent: function (component) {
|
|
24
|
+
placeholderElement = ReactElement.createElement(component);
|
|
27
25
|
}
|
|
28
26
|
};
|
|
29
27
|
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// need this check. We're going to assume if we're here it means we ran
|
|
35
|
-
// componentWillUnmount already so there is no internal instance (it gets
|
|
36
|
-
// removed as part of the unmounting process).
|
|
37
|
-
if (!internalInstance) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
registerNullComponentID(internalInstance._rootNodeID);
|
|
28
|
+
var ReactEmptyComponent = function (instantiate) {
|
|
29
|
+
this._currentElement = null;
|
|
30
|
+
this._rootNodeID = null;
|
|
31
|
+
this._renderedComponent = instantiate(placeholderElement);
|
|
41
32
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
assign(ReactEmptyComponent.prototype, {
|
|
34
|
+
construct: function (element) {},
|
|
35
|
+
mountComponent: function (rootID, transaction, context) {
|
|
36
|
+
ReactEmptyComponentRegistry.registerNullComponentID(rootID);
|
|
37
|
+
this._rootNodeID = rootID;
|
|
38
|
+
return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
|
|
39
|
+
},
|
|
40
|
+
receiveComponent: function () {},
|
|
41
|
+
unmountComponent: function (rootID, transaction, context) {
|
|
42
|
+
ReactReconciler.unmountComponent(this._renderedComponent);
|
|
43
|
+
ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
|
|
44
|
+
this._rootNodeID = null;
|
|
45
|
+
this._renderedComponent = null;
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
ReactEmptyComponentType.prototype.render = function () {
|
|
51
|
-
!component ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to return null from a render, but no null placeholder component ' + 'was injected.') : invariant(false) : undefined;
|
|
52
|
-
return component();
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Mark the component as having rendered to null.
|
|
59
|
-
* @param {string} id Component's `_rootNodeID`.
|
|
60
|
-
*/
|
|
61
|
-
function registerNullComponentID(id) {
|
|
62
|
-
nullComponentIDsRegistry[id] = true;
|
|
63
|
-
}
|
|
47
|
+
});
|
|
64
48
|
|
|
65
|
-
|
|
66
|
-
* Unmark the component as having rendered to null: it renders to something now.
|
|
67
|
-
* @param {string} id Component's `_rootNodeID`.
|
|
68
|
-
*/
|
|
69
|
-
function deregisterNullComponentID(id) {
|
|
70
|
-
delete nullComponentIDsRegistry[id];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @param {string} id Component's `_rootNodeID`.
|
|
75
|
-
* @return {boolean} True if the component is rendered to null.
|
|
76
|
-
*/
|
|
77
|
-
function isNullComponentID(id) {
|
|
78
|
-
return !!nullComponentIDsRegistry[id];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var ReactEmptyComponent = {
|
|
82
|
-
emptyElement: emptyElement,
|
|
83
|
-
injection: ReactEmptyComponentInjection,
|
|
84
|
-
isNullComponentID: isNullComponentID
|
|
85
|
-
};
|
|
49
|
+
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
|
|
86
50
|
|
|
87
51
|
module.exports = ReactEmptyComponent;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014-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 ReactEmptyComponentRegistry
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
// This registry keeps track of the React IDs of the components that rendered to
|
|
15
|
+
// `null` (in reality a placeholder such as `noscript`)
|
|
16
|
+
var nullComponentIDsRegistry = {};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {string} id Component's `_rootNodeID`.
|
|
20
|
+
* @return {boolean} True if the component is rendered to null.
|
|
21
|
+
*/
|
|
22
|
+
function isNullComponentID(id) {
|
|
23
|
+
return !!nullComponentIDsRegistry[id];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Mark the component as having rendered to null.
|
|
28
|
+
* @param {string} id Component's `_rootNodeID`.
|
|
29
|
+
*/
|
|
30
|
+
function registerNullComponentID(id) {
|
|
31
|
+
nullComponentIDsRegistry[id] = true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Unmark the component as having rendered to null: it renders to something now.
|
|
36
|
+
* @param {string} id Component's `_rootNodeID`.
|
|
37
|
+
*/
|
|
38
|
+
function deregisterNullComponentID(id) {
|
|
39
|
+
delete nullComponentIDsRegistry[id];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var ReactEmptyComponentRegistry = {
|
|
43
|
+
isNullComponentID: isNullComponentID,
|
|
44
|
+
registerNullComponentID: registerNullComponentID,
|
|
45
|
+
deregisterNullComponentID: deregisterNullComponentID
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports = ReactEmptyComponentRegistry;
|
package/lib/ReactErrorUtils.js
CHANGED
|
@@ -12,19 +12,55 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
+
var caughtError = null;
|
|
16
|
+
|
|
15
17
|
var ReactErrorUtils = {
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
18
|
-
* of event handlers easier. To aid debugging with the browser's debugger,
|
|
19
|
-
* this currently simply returns the original function.
|
|
19
|
+
* Call a function while guarding against errors that happens within it.
|
|
20
20
|
*
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
23
|
-
* @
|
|
21
|
+
* @param {?String} name of the guard to use for logging or debugging
|
|
22
|
+
* @param {Function} func The function to invoke
|
|
23
|
+
* @param {*} a First argument
|
|
24
|
+
* @param {*} b Second argument
|
|
25
|
+
*/
|
|
26
|
+
invokeGuardedCallback: function (name, func, a, b) {
|
|
27
|
+
try {
|
|
28
|
+
return func(a, b);
|
|
29
|
+
} catch (x) {
|
|
30
|
+
if (caughtError === null) {
|
|
31
|
+
caughtError = x;
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* During execution of guarded functions we will capture the first error which
|
|
39
|
+
* we will rethrow to be handled by the top level error handler.
|
|
24
40
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
rethrowCaughtError: function () {
|
|
42
|
+
if (caughtError) {
|
|
43
|
+
var error = caughtError;
|
|
44
|
+
caughtError = null;
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
27
47
|
}
|
|
28
48
|
};
|
|
29
49
|
|
|
50
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
51
|
+
/**
|
|
52
|
+
* To help development we can get better devtools integration by simulating a
|
|
53
|
+
* real browser event.
|
|
54
|
+
*/
|
|
55
|
+
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof Event === 'function') {
|
|
56
|
+
var fakeNode = document.createElement('react');
|
|
57
|
+
ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
|
|
58
|
+
var boundFunc = func.bind(null, a, b);
|
|
59
|
+
fakeNode.addEventListener(name, boundFunc, false);
|
|
60
|
+
fakeNode.dispatchEvent(new Event(name));
|
|
61
|
+
fakeNode.removeEventListener(name, boundFunc, false);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
30
66
|
module.exports = ReactErrorUtils;
|
|
@@ -59,13 +59,18 @@ assign(TopLevelCallbackBookKeeping.prototype, {
|
|
|
59
59
|
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
|
|
60
60
|
|
|
61
61
|
function handleTopLevelImpl(bookKeeping) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
// TODO: Re-enable event.path handling
|
|
63
|
+
//
|
|
64
|
+
// if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
|
|
65
|
+
// // New browsers have a path attribute on native events
|
|
66
|
+
// handleTopLevelWithPath(bookKeeping);
|
|
67
|
+
// } else {
|
|
68
|
+
// // Legacy browsers don't have a path attribute on native events
|
|
69
|
+
// handleTopLevelWithoutPath(bookKeeping);
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
void handleTopLevelWithPath; // temporarily unused
|
|
73
|
+
handleTopLevelWithoutPath(bookKeeping);
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
// Legacy browsers don't have a path attribute on native events
|
|
@@ -96,11 +101,13 @@ function handleTopLevelWithPath(bookKeeping) {
|
|
|
96
101
|
var eventsFired = 0;
|
|
97
102
|
for (var i = 0; i < path.length; i++) {
|
|
98
103
|
var currentPathElement = path[i];
|
|
99
|
-
var currentPathElementID = ReactMount.getID(currentPathElement);
|
|
100
104
|
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
|
|
101
105
|
currentNativeTarget = path[i + 1];
|
|
102
106
|
}
|
|
103
|
-
|
|
107
|
+
// TODO: slow
|
|
108
|
+
var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
|
|
109
|
+
if (reactParent === currentPathElement) {
|
|
110
|
+
var currentPathElementID = ReactMount.getID(currentPathElement);
|
|
104
111
|
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
|
|
105
112
|
bookKeeping.ancestors.push(currentPathElement);
|
|
106
113
|
|
package/lib/ReactFragment.js
CHANGED
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var ReactChildren = require('./ReactChildren');
|
|
14
15
|
var ReactElement = require('./ReactElement');
|
|
15
16
|
|
|
17
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
18
|
+
var invariant = require('fbjs/lib/invariant');
|
|
16
19
|
var warning = require('fbjs/lib/warning');
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -20,135 +23,41 @@ var warning = require('fbjs/lib/warning');
|
|
|
20
23
|
* or nested sets. This allowed us a way to explicitly key a set a fragment of
|
|
21
24
|
* components. This is now being replaced with an opaque data structure.
|
|
22
25
|
* The upgrade path is to call React.addons.createFragment({ key: value }) to
|
|
23
|
-
* create a keyed fragment. The resulting data structure is
|
|
26
|
+
* create a keyed fragment. The resulting data structure is an array.
|
|
24
27
|
*/
|
|
25
28
|
|
|
26
|
-
var
|
|
27
|
-
var didWarnKey;
|
|
28
|
-
var canWarnForReactFragment;
|
|
29
|
+
var numericPropertyRegex = /^\d+$/;
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
fragmentKey = '_reactFragment';
|
|
32
|
-
didWarnKey = '_reactDidWarn';
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
// Feature test. Don't even try to issue this warning if we can't use
|
|
36
|
-
// enumerable: false.
|
|
37
|
-
|
|
38
|
-
var dummy = function () {
|
|
39
|
-
return 1;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
Object.defineProperty({}, fragmentKey, { enumerable: false, value: true });
|
|
43
|
-
|
|
44
|
-
Object.defineProperty({}, 'key', { enumerable: true, get: dummy });
|
|
45
|
-
|
|
46
|
-
canWarnForReactFragment = true;
|
|
47
|
-
} catch (x) {
|
|
48
|
-
canWarnForReactFragment = false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var proxyPropertyAccessWithWarning = function (obj, key) {
|
|
52
|
-
Object.defineProperty(obj, key, {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () {
|
|
55
|
-
process.env.NODE_ENV !== 'production' ? warning(this[didWarnKey], 'A ReactFragment is an opaque type. Accessing any of its ' + 'properties is deprecated. Pass it to one of the React.Children ' + 'helpers.') : undefined;
|
|
56
|
-
this[didWarnKey] = true;
|
|
57
|
-
return this[fragmentKey][key];
|
|
58
|
-
},
|
|
59
|
-
set: function (value) {
|
|
60
|
-
process.env.NODE_ENV !== 'production' ? warning(this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.') : undefined;
|
|
61
|
-
this[didWarnKey] = true;
|
|
62
|
-
this[fragmentKey][key] = value;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var issuedWarnings = {};
|
|
68
|
-
|
|
69
|
-
var didWarnForFragment = function (fragment) {
|
|
70
|
-
// We use the keys and the type of the value as a heuristic to dedupe the
|
|
71
|
-
// warning to avoid spamming too much.
|
|
72
|
-
var fragmentCacheKey = '';
|
|
73
|
-
for (var key in fragment) {
|
|
74
|
-
fragmentCacheKey += key + ':' + typeof fragment[key] + ',';
|
|
75
|
-
}
|
|
76
|
-
var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
|
|
77
|
-
issuedWarnings[fragmentCacheKey] = true;
|
|
78
|
-
return alreadyWarnedOnce;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
31
|
+
var warnedAboutNumeric = false;
|
|
81
32
|
|
|
82
33
|
var ReactFragment = {
|
|
83
34
|
// Wrap a keyed object in an opaque proxy that warns you if you access any
|
|
84
35
|
// of its properties.
|
|
85
36
|
create: function (object) {
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return object;
|
|
90
|
-
}
|
|
91
|
-
if (ReactElement.isValidElement(object)) {
|
|
92
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
|
|
93
|
-
return object;
|
|
94
|
-
}
|
|
95
|
-
if (canWarnForReactFragment) {
|
|
96
|
-
var proxy = {};
|
|
97
|
-
Object.defineProperty(proxy, fragmentKey, {
|
|
98
|
-
enumerable: false,
|
|
99
|
-
value: object
|
|
100
|
-
});
|
|
101
|
-
Object.defineProperty(proxy, didWarnKey, {
|
|
102
|
-
writable: true,
|
|
103
|
-
enumerable: false,
|
|
104
|
-
value: false
|
|
105
|
-
});
|
|
106
|
-
for (var key in object) {
|
|
107
|
-
proxyPropertyAccessWithWarning(proxy, key);
|
|
108
|
-
}
|
|
109
|
-
Object.preventExtensions(proxy);
|
|
110
|
-
return proxy;
|
|
111
|
-
}
|
|
37
|
+
if (typeof object !== 'object' || !object || Array.isArray(object)) {
|
|
38
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
|
|
39
|
+
return object;
|
|
112
40
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// a plain object is passed here.
|
|
117
|
-
extract: function (fragment) {
|
|
118
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
119
|
-
if (canWarnForReactFragment) {
|
|
120
|
-
if (!fragment[fragmentKey]) {
|
|
121
|
-
process.env.NODE_ENV !== 'production' ? warning(didWarnForFragment(fragment), 'Any use of a keyed object should be wrapped in ' + 'React.addons.createFragment(object) before being passed as a ' + 'child.') : undefined;
|
|
122
|
-
return fragment;
|
|
123
|
-
}
|
|
124
|
-
return fragment[fragmentKey];
|
|
125
|
-
}
|
|
41
|
+
if (ReactElement.isValidElement(object)) {
|
|
42
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
|
|
43
|
+
return object;
|
|
126
44
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return fragment[fragmentKey];
|
|
138
|
-
}
|
|
139
|
-
// Otherwise, check each property if it has an element, if it does
|
|
140
|
-
// it is probably meant as a fragment, so we can warn early. Defer,
|
|
141
|
-
// the warning to extract.
|
|
142
|
-
for (var key in fragment) {
|
|
143
|
-
if (fragment.hasOwnProperty(key) && ReactElement.isValidElement(fragment[key])) {
|
|
144
|
-
// This looks like a fragment object, we should provide an
|
|
145
|
-
// early warning.
|
|
146
|
-
return ReactFragment.extract(fragment);
|
|
147
|
-
}
|
|
45
|
+
|
|
46
|
+
!(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
|
|
47
|
+
|
|
48
|
+
var result = [];
|
|
49
|
+
|
|
50
|
+
for (var key in object) {
|
|
51
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
52
|
+
if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
|
|
53
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
|
|
54
|
+
warnedAboutNumeric = true;
|
|
148
55
|
}
|
|
149
56
|
}
|
|
57
|
+
ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
|
|
150
58
|
}
|
|
151
|
-
|
|
59
|
+
|
|
60
|
+
return result;
|
|
152
61
|
}
|
|
153
62
|
};
|
|
154
63
|
|
package/lib/ReactInjection.js
CHANGED
|
@@ -18,7 +18,6 @@ var ReactClass = require('./ReactClass');
|
|
|
18
18
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
19
19
|
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
20
20
|
var ReactNativeComponent = require('./ReactNativeComponent');
|
|
21
|
-
var ReactDOMComponent = require('./ReactDOMComponent');
|
|
22
21
|
var ReactPerf = require('./ReactPerf');
|
|
23
22
|
var ReactRootIndex = require('./ReactRootIndex');
|
|
24
23
|
var ReactUpdates = require('./ReactUpdates');
|
|
@@ -26,7 +25,6 @@ var ReactUpdates = require('./ReactUpdates');
|
|
|
26
25
|
var ReactInjection = {
|
|
27
26
|
Component: ReactComponentEnvironment.injection,
|
|
28
27
|
Class: ReactClass.injection,
|
|
29
|
-
DOMComponent: ReactDOMComponent.injection,
|
|
30
28
|
DOMProperty: DOMProperty.injection,
|
|
31
29
|
EmptyComponent: ReactEmptyComponent.injection,
|
|
32
30
|
EventPluginHub: EventPluginHub.injection,
|
package/lib/ReactIsomorphic.js
CHANGED
|
@@ -18,6 +18,7 @@ var ReactDOMFactories = require('./ReactDOMFactories');
|
|
|
18
18
|
var ReactElement = require('./ReactElement');
|
|
19
19
|
var ReactElementValidator = require('./ReactElementValidator');
|
|
20
20
|
var ReactPropTypes = require('./ReactPropTypes');
|
|
21
|
+
var ReactVersion = require('./ReactVersion');
|
|
21
22
|
|
|
22
23
|
var assign = require('./Object.assign');
|
|
23
24
|
var onlyChild = require('./onlyChild');
|
|
@@ -40,6 +41,7 @@ var React = {
|
|
|
40
41
|
map: ReactChildren.map,
|
|
41
42
|
forEach: ReactChildren.forEach,
|
|
42
43
|
count: ReactChildren.count,
|
|
44
|
+
toArray: ReactChildren.toArray,
|
|
43
45
|
only: onlyChild
|
|
44
46
|
},
|
|
45
47
|
|
|
@@ -63,6 +65,8 @@ var React = {
|
|
|
63
65
|
// since they are just generating DOM strings.
|
|
64
66
|
DOM: ReactDOMFactories,
|
|
65
67
|
|
|
68
|
+
version: ReactVersion,
|
|
69
|
+
|
|
66
70
|
// Hook for JSX spread, don't use this for anything else.
|
|
67
71
|
__spread: assign
|
|
68
72
|
};
|