react 0.14.0-alpha2 → 0.14.0-beta3
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/README.md +5 -2
- package/addons.js +6 -3
- package/dist/JSXTransformer.js +634 -274
- package/dist/react-with-addons.js +5350 -4954
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4777 -4408
- package/dist/react.min.js +6 -5
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +16 -14
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +82 -117
- package/lib/DOMPropertyOperations.js +78 -33
- package/lib/Danger.js +14 -14
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +8 -8
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +13 -13
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +17 -17
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +13 -3
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +50 -38
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +14 -2
- package/lib/React.js +6 -6
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +20 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +9 -9
- package/lib/ReactClass.js +65 -83
- package/lib/ReactComponent.js +22 -17
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +3 -3
- package/lib/ReactCompositeComponent.js +80 -111
- package/lib/ReactDOM.js +72 -158
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMComponent.js +378 -56
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +23 -23
- package/lib/ReactDOMInput.js +83 -99
- package/lib/ReactDOMOption.js +25 -45
- package/lib/ReactDOMSelect.js +88 -98
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +2 -2
- package/lib/ReactDOMTextComponent.js +11 -11
- package/lib/ReactDOMTextarea.js +48 -61
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +24 -71
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +22 -83
- package/lib/ReactElementValidator.js +48 -117
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +3 -4
- package/lib/ReactEventListener.js +57 -12
- package/lib/ReactFragment.js +22 -17
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +8 -7
- package/lib/ReactInstanceHandles.js +12 -12
- package/lib/ReactIsomorphic.js +11 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +88 -88
- package/lib/ReactMultiChild.js +83 -22
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -8
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +49 -11
- package/lib/ReactReconcileTransaction.js +8 -8
- package/lib/ReactReconciler.js +18 -20
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +22 -9
- package/lib/ReactServerRenderingTransaction.js +7 -7
- package/lib/ReactTestUtils.js +80 -58
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +61 -36
- package/lib/ReactUpdates.js +14 -17
- package/lib/ReactWithAddons.js +14 -16
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +14 -15
- package/lib/SimpleEventPlugin.js +205 -29
- package/lib/SyntheticClipboardEvent.js +3 -3
- package/lib/SyntheticCompositionEvent.js +3 -3
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +9 -8
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +3 -3
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +5 -5
- package/lib/SyntheticTouchEvent.js +4 -4
- package/lib/SyntheticUIEvent.js +4 -4
- package/lib/SyntheticWheelEvent.js +3 -3
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +16 -10
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +12 -7
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +47 -0
- package/lib/findDOMNode.js +11 -12
- package/lib/flattenChildren.js +4 -4
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +0 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +24 -20
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +2 -1
- package/lib/joinClasses.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +2 -2
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +15 -14
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +14 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +53 -1
- package/addons/CSSTransitionGroup.js +0 -1
- package/addons/LinkedStateMixin.js +0 -1
- package/addons/Perf.js +0 -1
- package/addons/PureRenderMixin.js +0 -1
- package/addons/TestUtils.js +0 -1
- package/addons/TransitionGroup.js +0 -1
- package/addons/batchedUpdates.js +0 -1
- package/addons/cloneWithProps.js +0 -1
- package/addons/createFragment.js +0 -1
- package/addons/renderSubtreeIntoContainer.js +0 -1
- package/addons/shallowCompare.js +0 -1
- package/addons/update.js +0 -1
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/LocalEventTrapMixin.js +0 -46
- package/lib/ReactContext.js +0 -32
- package/lib/ReactDOMClient.js +0 -85
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createFullPageComponent.js +0 -51
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/emptyObject.js +0 -20
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -115
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -61
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactElement = require(
|
|
15
|
-
var ReactInstanceMap = require(
|
|
14
|
+
var ReactElement = require('./ReactElement');
|
|
15
|
+
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
16
16
|
|
|
17
|
-
var invariant = require(
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
18
|
|
|
19
19
|
var component;
|
|
20
20
|
// This registry keeps track of the React IDs of the components that rendered to
|
|
@@ -48,7 +48,7 @@ ReactEmptyComponentType.prototype.componentWillUnmount = function () {
|
|
|
48
48
|
deregisterNullComponentID(internalInstance._rootNodeID);
|
|
49
49
|
};
|
|
50
50
|
ReactEmptyComponentType.prototype.render = function () {
|
|
51
|
-
|
|
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
52
|
return component();
|
|
53
53
|
};
|
|
54
54
|
|
package/lib/ReactErrorUtils.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventPluginHub = require(
|
|
14
|
+
var EventPluginHub = require('./EventPluginHub');
|
|
15
15
|
|
|
16
16
|
function runEventQueueInBatch(events) {
|
|
17
17
|
EventPluginHub.enqueueEvents(events);
|
|
@@ -29,9 +29,8 @@ var ReactEventEmitterMixin = {
|
|
|
29
29
|
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
|
30
30
|
* @param {object} nativeEvent Native environment event.
|
|
31
31
|
*/
|
|
32
|
-
handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
|
|
33
|
-
var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent);
|
|
34
|
-
|
|
32
|
+
handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
|
33
|
+
var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
|
|
35
34
|
runEventQueueInBatch(events);
|
|
36
35
|
}
|
|
37
36
|
};
|
|
@@ -12,16 +12,18 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var EventListener = require(
|
|
16
|
-
var ExecutionEnvironment = require(
|
|
17
|
-
var PooledClass = require(
|
|
18
|
-
var ReactInstanceHandles = require(
|
|
19
|
-
var ReactMount = require(
|
|
20
|
-
var ReactUpdates = require(
|
|
15
|
+
var EventListener = require('fbjs/lib/EventListener');
|
|
16
|
+
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
17
|
+
var PooledClass = require('./PooledClass');
|
|
18
|
+
var ReactInstanceHandles = require('./ReactInstanceHandles');
|
|
19
|
+
var ReactMount = require('./ReactMount');
|
|
20
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
21
21
|
|
|
22
|
-
var assign = require(
|
|
23
|
-
var getEventTarget = require(
|
|
24
|
-
var getUnboundedScrollPosition = require(
|
|
22
|
+
var assign = require('./Object.assign');
|
|
23
|
+
var getEventTarget = require('./getEventTarget');
|
|
24
|
+
var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
|
|
25
|
+
|
|
26
|
+
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Finds the parent React component of `node`.
|
|
@@ -57,6 +59,17 @@ assign(TopLevelCallbackBookKeeping.prototype, {
|
|
|
57
59
|
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
|
|
58
60
|
|
|
59
61
|
function handleTopLevelImpl(bookKeeping) {
|
|
62
|
+
if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
|
|
63
|
+
// New browsers have a path attribute on native events
|
|
64
|
+
handleTopLevelWithPath(bookKeeping);
|
|
65
|
+
} else {
|
|
66
|
+
// Legacy browsers don't have a path attribute on native events
|
|
67
|
+
handleTopLevelWithoutPath(bookKeeping);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Legacy browsers don't have a path attribute on native events
|
|
72
|
+
function handleTopLevelWithoutPath(bookKeeping) {
|
|
60
73
|
var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
|
|
61
74
|
|
|
62
75
|
// Loop through the hierarchy, in case there's any nested components.
|
|
@@ -72,7 +85,39 @@ function handleTopLevelImpl(bookKeeping) {
|
|
|
72
85
|
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
|
|
73
86
|
topLevelTarget = bookKeeping.ancestors[i];
|
|
74
87
|
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
|
|
75
|
-
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent);
|
|
88
|
+
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// New browsers have a path attribute on native events
|
|
93
|
+
function handleTopLevelWithPath(bookKeeping) {
|
|
94
|
+
var path = bookKeeping.nativeEvent.path;
|
|
95
|
+
var currentNativeTarget = path[0];
|
|
96
|
+
var eventsFired = 0;
|
|
97
|
+
for (var i = 0; i < path.length; i++) {
|
|
98
|
+
var currentPathElement = path[i];
|
|
99
|
+
var currentPathElementID = ReactMount.getID(currentPathElement);
|
|
100
|
+
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
|
|
101
|
+
currentNativeTarget = path[i + 1];
|
|
102
|
+
}
|
|
103
|
+
if (ReactMount.isRenderedByReact(currentPathElement)) {
|
|
104
|
+
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
|
|
105
|
+
bookKeeping.ancestors.push(currentPathElement);
|
|
106
|
+
|
|
107
|
+
var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
|
|
108
|
+
eventsFired++;
|
|
109
|
+
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
|
|
110
|
+
|
|
111
|
+
// Jump to the root of this React render tree
|
|
112
|
+
while (currentPathElementID !== newRootID) {
|
|
113
|
+
i++;
|
|
114
|
+
currentPathElement = path[i];
|
|
115
|
+
currentPathElementID = ReactMount.getID(currentPathElement);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (eventsFired === 0) {
|
|
120
|
+
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
|
76
121
|
}
|
|
77
122
|
}
|
|
78
123
|
|
|
@@ -105,7 +150,7 @@ var ReactEventListener = {
|
|
|
105
150
|
* @param {string} topLevelType Record from `EventConstants`.
|
|
106
151
|
* @param {string} handlerBaseName Event name (e.g. "click").
|
|
107
152
|
* @param {object} handle Element on which to attach listener.
|
|
108
|
-
* @return {object} An object with a remove function which will forcefully
|
|
153
|
+
* @return {?object} An object with a remove function which will forcefully
|
|
109
154
|
* remove the listener.
|
|
110
155
|
* @internal
|
|
111
156
|
*/
|
|
@@ -123,7 +168,7 @@ var ReactEventListener = {
|
|
|
123
168
|
* @param {string} topLevelType Record from `EventConstants`.
|
|
124
169
|
* @param {string} handlerBaseName Event name (e.g. "click").
|
|
125
170
|
* @param {object} handle Element on which to attach listener.
|
|
126
|
-
* @return {object} An object with a remove function which will forcefully
|
|
171
|
+
* @return {?object} An object with a remove function which will forcefully
|
|
127
172
|
* remove the listener.
|
|
128
173
|
* @internal
|
|
129
174
|
*/
|
package/lib/ReactFragment.js
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule ReactFragment
|
|
10
|
-
*/
|
|
9
|
+
* @providesModule ReactFragment
|
|
10
|
+
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactElement = require(
|
|
14
|
+
var ReactElement = require('./ReactElement');
|
|
15
15
|
|
|
16
|
-
var warning = require(
|
|
16
|
+
var warning = require('fbjs/lib/warning');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* We used to allow keyed objects to serve as a collection of ReactElements,
|
|
@@ -23,10 +23,13 @@ var warning = require("./warning");
|
|
|
23
23
|
* create a keyed fragment. The resulting data structure is opaque, for now.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
var fragmentKey;
|
|
27
|
+
var didWarnKey;
|
|
28
|
+
var canWarnForReactFragment;
|
|
29
|
+
|
|
30
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
+
fragmentKey = '_reactFragment';
|
|
32
|
+
didWarnKey = '_reactDidWarn';
|
|
30
33
|
|
|
31
34
|
try {
|
|
32
35
|
// Feature test. Don't even try to issue this warning if we can't use
|
|
@@ -41,18 +44,20 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
41
44
|
Object.defineProperty({}, 'key', { enumerable: true, get: dummy });
|
|
42
45
|
|
|
43
46
|
canWarnForReactFragment = true;
|
|
44
|
-
} catch (x) {
|
|
47
|
+
} catch (x) {
|
|
48
|
+
canWarnForReactFragment = false;
|
|
49
|
+
}
|
|
45
50
|
|
|
46
51
|
var proxyPropertyAccessWithWarning = function (obj, key) {
|
|
47
52
|
Object.defineProperty(obj, key, {
|
|
48
53
|
enumerable: true,
|
|
49
54
|
get: function () {
|
|
50
|
-
|
|
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;
|
|
51
56
|
this[didWarnKey] = true;
|
|
52
57
|
return this[fragmentKey][key];
|
|
53
58
|
},
|
|
54
59
|
set: function (value) {
|
|
55
|
-
|
|
60
|
+
process.env.NODE_ENV !== 'production' ? warning(this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.') : undefined;
|
|
56
61
|
this[didWarnKey] = true;
|
|
57
62
|
this[fragmentKey][key] = value;
|
|
58
63
|
}
|
|
@@ -78,13 +83,13 @@ var ReactFragment = {
|
|
|
78
83
|
// Wrap a keyed object in an opaque proxy that warns you if you access any
|
|
79
84
|
// of its properties.
|
|
80
85
|
create: function (object) {
|
|
81
|
-
if (
|
|
86
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
82
87
|
if (typeof object !== 'object' || !object || Array.isArray(object)) {
|
|
83
|
-
|
|
88
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
|
|
84
89
|
return object;
|
|
85
90
|
}
|
|
86
91
|
if (ReactElement.isValidElement(object)) {
|
|
87
|
-
|
|
92
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
|
|
88
93
|
return object;
|
|
89
94
|
}
|
|
90
95
|
if (canWarnForReactFragment) {
|
|
@@ -110,10 +115,10 @@ var ReactFragment = {
|
|
|
110
115
|
// Extract the original keyed object from the fragment opaque type. Warn if
|
|
111
116
|
// a plain object is passed here.
|
|
112
117
|
extract: function (fragment) {
|
|
113
|
-
if (
|
|
118
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
114
119
|
if (canWarnForReactFragment) {
|
|
115
120
|
if (!fragment[fragmentKey]) {
|
|
116
|
-
|
|
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;
|
|
117
122
|
return fragment;
|
|
118
123
|
}
|
|
119
124
|
return fragment[fragmentKey];
|
|
@@ -125,7 +130,7 @@ var ReactFragment = {
|
|
|
125
130
|
// is a fragment-like object, warn that it should be wrapped. Ignore if we
|
|
126
131
|
// can't determine what kind of object this is.
|
|
127
132
|
extractIfFragment: function (fragment) {
|
|
128
|
-
if (
|
|
133
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
129
134
|
if (canWarnForReactFragment) {
|
|
130
135
|
// If it is the opaque type, return the keyed object.
|
|
131
136
|
if (fragment[fragmentKey]) {
|
package/lib/ReactInjection.js
CHANGED
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var DOMProperty = require(
|
|
15
|
-
var EventPluginHub = require(
|
|
16
|
-
var ReactComponentEnvironment = require(
|
|
17
|
-
var ReactClass = require(
|
|
18
|
-
var ReactEmptyComponent = require(
|
|
19
|
-
var ReactBrowserEventEmitter = require(
|
|
20
|
-
var ReactNativeComponent = require(
|
|
21
|
-
var ReactDOMComponent = require(
|
|
22
|
-
var ReactPerf = require(
|
|
23
|
-
var ReactRootIndex = require(
|
|
24
|
-
var ReactUpdates = require(
|
|
14
|
+
var DOMProperty = require('./DOMProperty');
|
|
15
|
+
var EventPluginHub = require('./EventPluginHub');
|
|
16
|
+
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
17
|
+
var ReactClass = require('./ReactClass');
|
|
18
|
+
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
19
|
+
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
20
|
+
var ReactNativeComponent = require('./ReactNativeComponent');
|
|
21
|
+
var ReactDOMComponent = require('./ReactDOMComponent');
|
|
22
|
+
var ReactPerf = require('./ReactPerf');
|
|
23
|
+
var ReactRootIndex = require('./ReactRootIndex');
|
|
24
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
25
25
|
|
|
26
26
|
var ReactInjection = {
|
|
27
27
|
Component: ReactComponentEnvironment.injection,
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactDOMSelection = require(
|
|
14
|
+
var ReactDOMSelection = require('./ReactDOMSelection');
|
|
15
15
|
|
|
16
|
-
var containsNode = require(
|
|
17
|
-
var focusNode = require(
|
|
18
|
-
var getActiveElement = require(
|
|
16
|
+
var containsNode = require('fbjs/lib/containsNode');
|
|
17
|
+
var focusNode = require('fbjs/lib/focusNode');
|
|
18
|
+
var getActiveElement = require('fbjs/lib/getActiveElement');
|
|
19
19
|
|
|
20
20
|
function isInDocument(node) {
|
|
21
21
|
return containsNode(document.documentElement, node);
|
|
@@ -30,7 +30,8 @@ function isInDocument(node) {
|
|
|
30
30
|
var ReactInputSelection = {
|
|
31
31
|
|
|
32
32
|
hasSelectionCapabilities: function (elem) {
|
|
33
|
-
|
|
33
|
+
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
|
34
|
+
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
|
|
34
35
|
},
|
|
35
36
|
|
|
36
37
|
getSelectionInformation: function () {
|
|
@@ -73,7 +74,7 @@ var ReactInputSelection = {
|
|
|
73
74
|
start: input.selectionStart,
|
|
74
75
|
end: input.selectionEnd
|
|
75
76
|
};
|
|
76
|
-
} else if (document.selection && input.nodeName === '
|
|
77
|
+
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
|
|
77
78
|
// IE8 input.
|
|
78
79
|
var range = document.selection.createRange();
|
|
79
80
|
// There can only be one selection per document in IE, so it must
|
|
@@ -108,7 +109,7 @@ var ReactInputSelection = {
|
|
|
108
109
|
if ('selectionStart' in input) {
|
|
109
110
|
input.selectionStart = start;
|
|
110
111
|
input.selectionEnd = Math.min(end, input.value.length);
|
|
111
|
-
} else if (document.selection && input.nodeName === '
|
|
112
|
+
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
|
|
112
113
|
var range = input.createTextRange();
|
|
113
114
|
range.collapse(true);
|
|
114
115
|
range.moveStart('character', start);
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactRootIndex = require(
|
|
15
|
+
var ReactRootIndex = require('./ReactRootIndex');
|
|
16
16
|
|
|
17
|
-
var invariant = require(
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
18
|
|
|
19
19
|
var SEPARATOR = '.';
|
|
20
20
|
var SEPARATOR_LENGTH = SEPARATOR.length;
|
|
@@ -22,7 +22,7 @@ var SEPARATOR_LENGTH = SEPARATOR.length;
|
|
|
22
22
|
/**
|
|
23
23
|
* Maximum depth of traversals before we consider the possibility of a bad ID.
|
|
24
24
|
*/
|
|
25
|
-
var MAX_TREE_DEPTH =
|
|
25
|
+
var MAX_TREE_DEPTH = 10000;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Creates a DOM ID prefix to use when mounting React components.
|
|
@@ -91,8 +91,8 @@ function getParentID(id) {
|
|
|
91
91
|
* @private
|
|
92
92
|
*/
|
|
93
93
|
function getNextDescendantID(ancestorID, destinationID) {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
!(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
|
|
95
|
+
!isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
|
|
96
96
|
if (ancestorID === destinationID) {
|
|
97
97
|
return ancestorID;
|
|
98
98
|
}
|
|
@@ -134,7 +134,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
|
|
137
|
-
|
|
137
|
+
!isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
|
|
138
138
|
return longestCommonID;
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -146,6 +146,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
146
146
|
* @param {?string} start ID at which to start traversal.
|
|
147
147
|
* @param {?string} stop ID at which to end traversal.
|
|
148
148
|
* @param {function} cb Callback to invoke each ID with.
|
|
149
|
+
* @param {*} arg Argument to invoke the callback with.
|
|
149
150
|
* @param {?boolean} skipFirst Whether or not to skip the first node.
|
|
150
151
|
* @param {?boolean} skipLast Whether or not to skip the last node.
|
|
151
152
|
* @private
|
|
@@ -153,13 +154,13 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
153
154
|
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
154
155
|
start = start || '';
|
|
155
156
|
stop = stop || '';
|
|
156
|
-
|
|
157
|
+
!(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
|
|
157
158
|
var traverseUp = isAncestorIDOf(stop, start);
|
|
158
|
-
|
|
159
|
+
!(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
|
|
159
160
|
// Traverse from `start` to `stop` one depth at a time.
|
|
160
161
|
var depth = 0;
|
|
161
162
|
var traverse = traverseUp ? getParentID : getNextDescendantID;
|
|
162
|
-
for (var id = start;; id = traverse(id, stop)) {
|
|
163
|
+
for (var id = start;; /* until break */id = traverse(id, stop)) {
|
|
163
164
|
var ret;
|
|
164
165
|
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
|
|
165
166
|
ret = cb(id, traverseUp, arg);
|
|
@@ -168,7 +169,7 @@ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
|
168
169
|
// Only break //after// visiting `stop`.
|
|
169
170
|
break;
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
+
!(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
|
|
@@ -298,5 +299,4 @@ var ReactInstanceHandles = {
|
|
|
298
299
|
|
|
299
300
|
};
|
|
300
301
|
|
|
301
|
-
module.exports = ReactInstanceHandles;
|
|
302
|
-
/* until break */
|
|
302
|
+
module.exports = ReactInstanceHandles;
|
package/lib/ReactIsomorphic.js
CHANGED
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactChildren = require(
|
|
15
|
-
var ReactComponent = require(
|
|
16
|
-
var ReactClass = require(
|
|
17
|
-
var
|
|
18
|
-
var ReactElement = require(
|
|
19
|
-
var ReactElementValidator = require(
|
|
20
|
-
var ReactPropTypes = require(
|
|
14
|
+
var ReactChildren = require('./ReactChildren');
|
|
15
|
+
var ReactComponent = require('./ReactComponent');
|
|
16
|
+
var ReactClass = require('./ReactClass');
|
|
17
|
+
var ReactDOMFactories = require('./ReactDOMFactories');
|
|
18
|
+
var ReactElement = require('./ReactElement');
|
|
19
|
+
var ReactElementValidator = require('./ReactElementValidator');
|
|
20
|
+
var ReactPropTypes = require('./ReactPropTypes');
|
|
21
21
|
|
|
22
|
-
var assign = require(
|
|
23
|
-
var onlyChild = require(
|
|
22
|
+
var assign = require('./Object.assign');
|
|
23
|
+
var onlyChild = require('./onlyChild');
|
|
24
24
|
|
|
25
25
|
var createElement = ReactElement.createElement;
|
|
26
26
|
var createFactory = ReactElement.createFactory;
|
|
27
27
|
var cloneElement = ReactElement.cloneElement;
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
30
30
|
createElement = ReactElementValidator.createElement;
|
|
31
31
|
createFactory = ReactElementValidator.createFactory;
|
|
32
32
|
cloneElement = ReactElementValidator.cloneElement;
|
|
@@ -61,7 +61,7 @@ var React = {
|
|
|
61
61
|
|
|
62
62
|
// This looks DOM specific but these are actually isomorphic helpers
|
|
63
63
|
// since they are just generating DOM strings.
|
|
64
|
-
DOM:
|
|
64
|
+
DOM: ReactDOMFactories,
|
|
65
65
|
|
|
66
66
|
// Hook for JSX spread, don't use this for anything else.
|
|
67
67
|
__spread: assign
|