react 0.14.7 → 0.15.0-alpha.1
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/LICENSE +1 -1
- package/dist/react-with-addons.js +2937 -3414
- package/dist/react-with-addons.min.js +7 -7
- package/dist/react.js +2762 -3034
- package/dist/react.min.js +7 -7
- package/lib/AutoFocusUtils.js +3 -15
- package/lib/BeforeInputEventPlugin.js +8 -25
- package/lib/CSSProperty.js +3 -1
- package/lib/CSSPropertyOperations.js +20 -6
- package/lib/CallbackQueue.js +12 -1
- package/lib/ChangeEventPlugin.js +58 -54
- package/lib/DOMChildrenOperations.js +21 -60
- package/lib/DOMLazyTree.js +95 -0
- package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
- package/lib/DOMProperty.js +7 -2
- package/lib/DOMPropertyOperations.js +66 -36
- package/lib/Danger.js +6 -7
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +24 -43
- package/lib/EventConstants.js +2 -1
- package/lib/EventPluginHub.js +15 -59
- package/lib/EventPluginRegistry.js +23 -2
- package/lib/EventPluginUtils.js +60 -35
- package/lib/EventPropagators.js +19 -17
- package/lib/FallbackCompositionState.js +1 -2
- package/lib/HTMLDOMPropertyConfig.js +21 -23
- package/lib/LinkedInput.js +49 -0
- package/lib/LinkedStateMixin.js +1 -2
- package/lib/LinkedValueUtils.js +1 -2
- package/lib/MetaMatchers.js +2 -2
- package/lib/Object.assign.js +1 -1
- package/lib/OrderedMap.js +1 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +1 -13
- package/lib/ReactBrowserEventEmitter.js +3 -23
- package/lib/ReactCSSTransitionGroup.js +1 -2
- package/lib/ReactCSSTransitionGroupChild.js +1 -6
- package/lib/ReactChildReconciler.js +12 -10
- package/lib/ReactChildren.js +3 -3
- package/lib/ReactClass.js +18 -67
- package/lib/ReactComponent.js +2 -5
- package/lib/ReactComponentBrowserEnvironment.js +9 -6
- package/lib/ReactComponentEnvironment.js +3 -3
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +94 -29
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +26 -14
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +156 -218
- package/lib/ReactDOMComponentFlags.js +18 -0
- package/lib/ReactDOMComponentTree.js +186 -0
- package/lib/ReactDOMContainerInfo.js +32 -0
- package/lib/ReactDOMDebugTool.js +69 -0
- package/lib/ReactDOMEmptyComponent.js +61 -0
- package/lib/ReactDOMFactories.js +1 -2
- package/lib/ReactDOMFeatureFlags.js +2 -2
- package/lib/ReactDOMIDOperations.js +5 -60
- package/lib/ReactDOMInput.js +52 -23
- package/lib/ReactDOMInstrumentation.js +16 -0
- package/lib/ReactDOMOption.js +9 -8
- package/lib/ReactDOMSVGDeprecatedAttributeDevtool.js +57 -0
- package/lib/ReactDOMSelect.js +35 -14
- package/lib/ReactDOMSelection.js +2 -2
- package/lib/ReactDOMServer.js +1 -1
- package/lib/ReactDOMTextComponent.js +41 -21
- package/lib/ReactDOMTextarea.js +32 -5
- package/lib/ReactDOMTreeTraversal.js +134 -0
- package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +11 -15
- package/lib/ReactDefaultPerf.js +49 -19
- package/lib/ReactDefaultPerfAnalysis.js +16 -9
- package/lib/ReactElement.js +9 -5
- package/lib/ReactElementValidator.js +1 -1
- package/lib/ReactEmptyComponent.js +8 -29
- package/lib/ReactErrorUtils.js +1 -2
- package/lib/ReactEventEmitterMixin.js +3 -8
- package/lib/ReactEventListener.js +20 -75
- package/lib/ReactFeatureFlags.js +21 -0
- package/lib/ReactFragment.js +2 -2
- package/lib/ReactInjection.js +3 -3
- package/lib/ReactInputSelection.js +3 -3
- package/lib/ReactInstanceHandles.js +4 -6
- package/lib/ReactInstanceMap.js +1 -1
- package/lib/ReactIsomorphic.js +1 -1
- package/lib/ReactLink.js +1 -2
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +67 -445
- package/lib/ReactMultiChild.js +104 -198
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +1 -1
- package/lib/ReactNodeTypes.js +37 -0
- package/lib/ReactNoopUpdateQueue.js +1 -24
- package/lib/ReactOwner.js +1 -1
- package/lib/ReactPerf.js +1 -2
- package/lib/ReactPropTransferer.js +1 -1
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +8 -2
- package/lib/ReactReconcileTransaction.js +17 -6
- package/lib/ReactReconciler.js +14 -5
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +1 -2
- package/lib/ReactServerRendering.js +15 -33
- package/lib/ReactServerRenderingTransaction.js +8 -26
- package/lib/ReactSimpleEmptyComponent.js +37 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +25 -15
- package/lib/ReactTransitionChildMapping.js +1 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +1 -1
- package/lib/ReactUpdateQueue.js +4 -4
- package/lib/ReactUpdates.js +19 -2
- package/lib/ReactVersion.js +2 -2
- package/lib/ReactWithAddons.js +1 -3
- package/lib/ResponderEventPlugin.js +53 -65
- package/lib/ResponderSyntheticEvent.js +1 -2
- package/lib/ResponderTouchHistoryStore.js +1 -1
- package/lib/SVGDOMPropertyConfig.js +2 -39
- package/lib/SelectEventPlugin.js +13 -18
- package/lib/SimpleEventPlugin.js +18 -16
- package/lib/SyntheticClipboardEvent.js +1 -2
- package/lib/SyntheticCompositionEvent.js +1 -2
- package/lib/SyntheticDragEvent.js +1 -2
- package/lib/SyntheticEvent.js +10 -7
- package/lib/SyntheticFocusEvent.js +1 -2
- package/lib/SyntheticInputEvent.js +1 -2
- package/lib/SyntheticKeyboardEvent.js +1 -2
- package/lib/SyntheticMouseEvent.js +1 -2
- package/lib/SyntheticTouchEvent.js +1 -2
- package/lib/SyntheticUIEvent.js +1 -2
- package/lib/SyntheticWheelEvent.js +1 -2
- package/lib/TapEventPlugin.js +3 -12
- package/lib/Transaction.js +1 -1
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/accumulateInto.js +1 -1
- package/lib/adler32.js +3 -2
- package/lib/canDefineProperty.js +1 -1
- package/lib/createHierarchyRenderer.js +1 -1
- package/lib/dangerousStyleValue.js +25 -3
- package/lib/deprecated.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +15 -8
- package/lib/flattenChildren.js +1 -1
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -2
- package/lib/getEventKey.js +1 -2
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +1 -2
- package/lib/getIteratorFn.js +1 -2
- package/lib/getNativeComponentFromComposite.js +30 -0
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTestDocument.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +3 -4
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +1 -1
- package/lib/onlyChild.js +1 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +1 -1
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +1 -3
- package/lib/sliceChildren.js +1 -1
- package/lib/traverseAllChildren.js +6 -6
- package/lib/update.js +1 -1
- package/lib/validateDOMNesting.js +8 -9
- package/package.json +2 -2
- package/lib/ReactBrowserComponentMixin.js +0 -36
- package/lib/ReactEmptyComponentRegistry.js +0 -48
- package/lib/ReactRootIndex.js +0 -29
- package/lib/ServerReactRootIndex.js +0 -29
- package/lib/cloneWithProps.js +0 -54
- package/lib/webcomponents.js +0 -6379
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -167,18 +167,25 @@ function getUnchangedComponents(measurement) {
|
|
|
167
167
|
// render anything to the DOM and return a mapping of their ID to
|
|
168
168
|
// the amount of time it took to render the entire subtree.
|
|
169
169
|
var cleanComponents = {};
|
|
170
|
-
var
|
|
170
|
+
var writes = measurement.writes;
|
|
171
|
+
var dirtyComposites = {};
|
|
172
|
+
Object.keys(writes).forEach(function (id) {
|
|
173
|
+
writes[id].forEach(function (write) {
|
|
174
|
+
// Root mounting (innerHTML set) is recorded with an ID of ''
|
|
175
|
+
if (id !== '') {
|
|
176
|
+
measurement.hierarchy[id].forEach(function (c) {
|
|
177
|
+
return dirtyComposites[c] = true;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
171
182
|
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
|
|
172
183
|
|
|
173
184
|
for (var id in allIDs) {
|
|
174
185
|
var isDirty = false;
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (dirtyLeafIDs[i].indexOf(id) === 0) {
|
|
179
|
-
isDirty = true;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
186
|
+
// See if any of the DOM operations applied to this component's subtree.
|
|
187
|
+
if (dirtyComposites[id]) {
|
|
188
|
+
isDirty = true;
|
|
182
189
|
}
|
|
183
190
|
// check if component newly created
|
|
184
191
|
if (measurement.created[id]) {
|
package/lib/ReactElement.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014-
|
|
2
|
+
* Copyright 2014-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -28,8 +28,10 @@ var RESERVED_PROPS = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
32
|
+
* the class pattern, so do not use new to call it. Also, no instanceof check
|
|
33
|
+
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
34
|
+
* if something is a React Element.
|
|
33
35
|
*
|
|
34
36
|
* @param {*} type
|
|
35
37
|
* @param {*} key
|
|
@@ -98,8 +100,10 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
98
100
|
element._self = self;
|
|
99
101
|
element._source = source;
|
|
100
102
|
}
|
|
101
|
-
Object.freeze
|
|
102
|
-
|
|
103
|
+
if (Object.freeze) {
|
|
104
|
+
Object.freeze(element.props);
|
|
105
|
+
Object.freeze(element);
|
|
106
|
+
}
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
return element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014-
|
|
2
|
+
* Copyright 2014-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -11,40 +11,19 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
|
|
16
|
-
var ReactReconciler = require('./ReactReconciler');
|
|
17
|
-
|
|
18
|
-
var assign = require('./Object.assign');
|
|
19
|
-
|
|
20
|
-
var placeholderElement;
|
|
14
|
+
var emptyComponentFactory;
|
|
21
15
|
|
|
22
16
|
var ReactEmptyComponentInjection = {
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
injectEmptyComponentFactory: function (factory) {
|
|
18
|
+
emptyComponentFactory = factory;
|
|
25
19
|
}
|
|
26
20
|
};
|
|
27
21
|
|
|
28
|
-
var ReactEmptyComponent =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this._renderedComponent = instantiate(placeholderElement);
|
|
32
|
-
};
|
|
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;
|
|
22
|
+
var ReactEmptyComponent = {
|
|
23
|
+
create: function (instantiate) {
|
|
24
|
+
return emptyComponentFactory(instantiate);
|
|
46
25
|
}
|
|
47
|
-
}
|
|
26
|
+
};
|
|
48
27
|
|
|
49
28
|
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
|
|
50
29
|
|
package/lib/ReactErrorUtils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ReactErrorUtils
|
|
10
|
-
* @typechecks
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -23,14 +23,9 @@ var ReactEventEmitterMixin = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Streams a fired top-level event to `EventPluginHub` where plugins have the
|
|
25
25
|
* opportunity to create `ReactEvent`s to be dispatched.
|
|
26
|
-
*
|
|
27
|
-
* @param {string} topLevelType Record from `EventConstants`.
|
|
28
|
-
* @param {object} topLevelTarget The listening component root node.
|
|
29
|
-
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
|
30
|
-
* @param {object} nativeEvent Native environment event.
|
|
31
26
|
*/
|
|
32
|
-
handleTopLevel: function (topLevelType,
|
|
33
|
-
var events = EventPluginHub.extractEvents(topLevelType,
|
|
27
|
+
handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
28
|
+
var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
|
|
34
29
|
runEventQueueInBatch(events);
|
|
35
30
|
}
|
|
36
31
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ReactEventListener
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
|
@@ -15,32 +14,28 @@
|
|
|
15
14
|
var EventListener = require('fbjs/lib/EventListener');
|
|
16
15
|
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
17
16
|
var PooledClass = require('./PooledClass');
|
|
18
|
-
var
|
|
19
|
-
var ReactMount = require('./ReactMount');
|
|
17
|
+
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
20
18
|
var ReactUpdates = require('./ReactUpdates');
|
|
21
19
|
|
|
22
20
|
var assign = require('./Object.assign');
|
|
23
21
|
var getEventTarget = require('./getEventTarget');
|
|
24
22
|
var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
|
|
25
23
|
|
|
26
|
-
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
|
|
27
|
-
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
|
|
33
|
-
* is not nested.
|
|
25
|
+
* Find the deepest React component completely containing the root of the
|
|
26
|
+
* passed-in instance (for use when entire React trees are nested within each
|
|
27
|
+
* other). If React trees are not nested, returns null.
|
|
34
28
|
*/
|
|
35
|
-
function findParent(
|
|
29
|
+
function findParent(inst) {
|
|
36
30
|
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
|
|
37
31
|
// traversal, but caching is difficult to do correctly without using a
|
|
38
32
|
// mutation observer to listen for all DOM changes.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
|
|
33
|
+
while (inst._nativeParent) {
|
|
34
|
+
inst = inst._nativeParent;
|
|
35
|
+
}
|
|
36
|
+
var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
37
|
+
var container = rootNode.parentNode;
|
|
38
|
+
return ReactDOMComponentTree.getClosestInstanceFromNode(container);
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
// Used to store ancestor hierarchy in top level callback
|
|
@@ -59,72 +54,22 @@ assign(TopLevelCallbackBookKeeping.prototype, {
|
|
|
59
54
|
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
|
|
60
55
|
|
|
61
56
|
function handleTopLevelImpl(bookKeeping) {
|
|
62
|
-
|
|
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);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Legacy browsers don't have a path attribute on native events
|
|
77
|
-
function handleTopLevelWithoutPath(bookKeeping) {
|
|
78
|
-
var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
|
|
57
|
+
var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
|
|
58
|
+
var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
|
|
79
59
|
|
|
80
60
|
// Loop through the hierarchy, in case there's any nested components.
|
|
81
61
|
// It's important that we build the array of ancestors before calling any
|
|
82
62
|
// event handlers, because event handlers can modify the DOM, leading to
|
|
83
63
|
// inconsistencies with ReactMount's node cache. See #1105.
|
|
84
|
-
var ancestor =
|
|
85
|
-
|
|
64
|
+
var ancestor = targetInst;
|
|
65
|
+
do {
|
|
86
66
|
bookKeeping.ancestors.push(ancestor);
|
|
87
|
-
ancestor = findParent(ancestor);
|
|
88
|
-
}
|
|
67
|
+
ancestor = ancestor && findParent(ancestor);
|
|
68
|
+
} while (ancestor);
|
|
89
69
|
|
|
90
70
|
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// New browsers have a path attribute on native events
|
|
98
|
-
function handleTopLevelWithPath(bookKeeping) {
|
|
99
|
-
var path = bookKeeping.nativeEvent.path;
|
|
100
|
-
var currentNativeTarget = path[0];
|
|
101
|
-
var eventsFired = 0;
|
|
102
|
-
for (var i = 0; i < path.length; i++) {
|
|
103
|
-
var currentPathElement = path[i];
|
|
104
|
-
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
|
|
105
|
-
currentNativeTarget = path[i + 1];
|
|
106
|
-
}
|
|
107
|
-
// TODO: slow
|
|
108
|
-
var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
|
|
109
|
-
if (reactParent === currentPathElement) {
|
|
110
|
-
var currentPathElementID = ReactMount.getID(currentPathElement);
|
|
111
|
-
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
|
|
112
|
-
bookKeeping.ancestors.push(currentPathElement);
|
|
113
|
-
|
|
114
|
-
var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
|
|
115
|
-
eventsFired++;
|
|
116
|
-
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
|
|
117
|
-
|
|
118
|
-
// Jump to the root of this React render tree
|
|
119
|
-
while (currentPathElementID !== newRootID) {
|
|
120
|
-
i++;
|
|
121
|
-
currentPathElement = path[i];
|
|
122
|
-
currentPathElementID = ReactMount.getID(currentPathElement);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (eventsFired === 0) {
|
|
127
|
-
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
|
71
|
+
targetInst = bookKeeping.ancestors[i];
|
|
72
|
+
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
|
128
73
|
}
|
|
129
74
|
}
|
|
130
75
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-present, 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 ReactFeatureFlags
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var ReactFeatureFlags = {
|
|
15
|
+
// When true, call console.time() before and .timeEnd() after each top-level
|
|
16
|
+
// render (both initial renders and updates). Useful when looking at prod-mode
|
|
17
|
+
// timeline profiles in Chrome, for example.
|
|
18
|
+
logTopLevelRenders: false
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = ReactFeatureFlags;
|
package/lib/ReactFragment.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2015, Facebook, Inc.
|
|
2
|
+
* Copyright 2015-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -20,7 +20,7 @@ var warning = require('fbjs/lib/warning');
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* We used to allow keyed objects to serve as a collection of ReactElements,
|
|
23
|
-
* or nested sets. This allowed us a way to explicitly key a set
|
|
23
|
+
* or nested sets. This allowed us a way to explicitly key a set or fragment of
|
|
24
24
|
* components. This is now being replaced with an opaque data structure.
|
|
25
25
|
* The upgrade path is to call React.addons.createFragment({ key: value }) to
|
|
26
26
|
* create a keyed fragment. The resulting data structure is an array.
|
package/lib/ReactInjection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
|
|
14
14
|
var DOMProperty = require('./DOMProperty');
|
|
15
15
|
var EventPluginHub = require('./EventPluginHub');
|
|
16
|
+
var EventPluginUtils = require('./EventPluginUtils');
|
|
16
17
|
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
17
18
|
var ReactClass = require('./ReactClass');
|
|
18
19
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
19
20
|
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
20
21
|
var ReactNativeComponent = require('./ReactNativeComponent');
|
|
21
22
|
var ReactPerf = require('./ReactPerf');
|
|
22
|
-
var ReactRootIndex = require('./ReactRootIndex');
|
|
23
23
|
var ReactUpdates = require('./ReactUpdates');
|
|
24
24
|
|
|
25
25
|
var ReactInjection = {
|
|
@@ -28,10 +28,10 @@ var ReactInjection = {
|
|
|
28
28
|
DOMProperty: DOMProperty.injection,
|
|
29
29
|
EmptyComponent: ReactEmptyComponent.injection,
|
|
30
30
|
EventPluginHub: EventPluginHub.injection,
|
|
31
|
+
EventPluginUtils: EventPluginUtils.injection,
|
|
31
32
|
EventEmitter: ReactBrowserEventEmitter.injection,
|
|
32
33
|
NativeComponent: ReactNativeComponent.injection,
|
|
33
34
|
Perf: ReactPerf.injection,
|
|
34
|
-
RootIndex: ReactRootIndex.injection,
|
|
35
35
|
Updates: ReactUpdates.injection
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -74,7 +74,7 @@ var ReactInputSelection = {
|
|
|
74
74
|
start: input.selectionStart,
|
|
75
75
|
end: input.selectionEnd
|
|
76
76
|
};
|
|
77
|
-
} else if (document.selection &&
|
|
77
|
+
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
|
|
78
78
|
// IE8 input.
|
|
79
79
|
var range = document.selection.createRange();
|
|
80
80
|
// There can only be one selection per document in IE, so it must
|
|
@@ -109,7 +109,7 @@ var ReactInputSelection = {
|
|
|
109
109
|
if ('selectionStart' in input) {
|
|
110
110
|
input.selectionStart = start;
|
|
111
111
|
input.selectionEnd = Math.min(end, input.value.length);
|
|
112
|
-
} else if (document.selection &&
|
|
112
|
+
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
|
|
113
113
|
var range = input.createTextRange();
|
|
114
114
|
range.collapse(true);
|
|
115
115
|
range.moveStart('character', start);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -7,13 +7,10 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ReactInstanceHandles
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
|
14
13
|
|
|
15
|
-
var ReactRootIndex = require('./ReactRootIndex');
|
|
16
|
-
|
|
17
14
|
var invariant = require('fbjs/lib/invariant');
|
|
18
15
|
|
|
19
16
|
var SEPARATOR = '.';
|
|
@@ -184,10 +181,11 @@ var ReactInstanceHandles = {
|
|
|
184
181
|
|
|
185
182
|
/**
|
|
186
183
|
* Constructs a React root ID
|
|
184
|
+
* @param {number} index A unique integer
|
|
187
185
|
* @return {string} A React root ID.
|
|
188
186
|
*/
|
|
189
|
-
createReactRootID: function () {
|
|
190
|
-
return getReactRootIDString(
|
|
187
|
+
createReactRootID: function (index) {
|
|
188
|
+
return getReactRootIDString(index);
|
|
191
189
|
},
|
|
192
190
|
|
|
193
191
|
/**
|