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
|
|
@@ -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 ResponderSyntheticEvent
|
|
10
|
-
* @typechecks static-only
|
|
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,46 +23,19 @@ var NS = {
|
|
|
23
23
|
var SVGDOMPropertyConfig = {
|
|
24
24
|
Properties: {
|
|
25
25
|
clipPath: MUST_USE_ATTRIBUTE,
|
|
26
|
-
cx: MUST_USE_ATTRIBUTE,
|
|
27
|
-
cy: MUST_USE_ATTRIBUTE,
|
|
28
|
-
d: MUST_USE_ATTRIBUTE,
|
|
29
|
-
dx: MUST_USE_ATTRIBUTE,
|
|
30
|
-
dy: MUST_USE_ATTRIBUTE,
|
|
31
|
-
fill: MUST_USE_ATTRIBUTE,
|
|
32
26
|
fillOpacity: MUST_USE_ATTRIBUTE,
|
|
33
27
|
fontFamily: MUST_USE_ATTRIBUTE,
|
|
34
28
|
fontSize: MUST_USE_ATTRIBUTE,
|
|
35
|
-
fx: MUST_USE_ATTRIBUTE,
|
|
36
|
-
fy: MUST_USE_ATTRIBUTE,
|
|
37
|
-
gradientTransform: MUST_USE_ATTRIBUTE,
|
|
38
|
-
gradientUnits: MUST_USE_ATTRIBUTE,
|
|
39
29
|
markerEnd: MUST_USE_ATTRIBUTE,
|
|
40
30
|
markerMid: MUST_USE_ATTRIBUTE,
|
|
41
31
|
markerStart: MUST_USE_ATTRIBUTE,
|
|
42
|
-
offset: MUST_USE_ATTRIBUTE,
|
|
43
|
-
opacity: MUST_USE_ATTRIBUTE,
|
|
44
|
-
patternContentUnits: MUST_USE_ATTRIBUTE,
|
|
45
|
-
patternUnits: MUST_USE_ATTRIBUTE,
|
|
46
|
-
points: MUST_USE_ATTRIBUTE,
|
|
47
|
-
preserveAspectRatio: MUST_USE_ATTRIBUTE,
|
|
48
|
-
r: MUST_USE_ATTRIBUTE,
|
|
49
|
-
rx: MUST_USE_ATTRIBUTE,
|
|
50
|
-
ry: MUST_USE_ATTRIBUTE,
|
|
51
|
-
spreadMethod: MUST_USE_ATTRIBUTE,
|
|
52
32
|
stopColor: MUST_USE_ATTRIBUTE,
|
|
53
33
|
stopOpacity: MUST_USE_ATTRIBUTE,
|
|
54
|
-
stroke: MUST_USE_ATTRIBUTE,
|
|
55
34
|
strokeDasharray: MUST_USE_ATTRIBUTE,
|
|
56
35
|
strokeLinecap: MUST_USE_ATTRIBUTE,
|
|
57
36
|
strokeOpacity: MUST_USE_ATTRIBUTE,
|
|
58
37
|
strokeWidth: MUST_USE_ATTRIBUTE,
|
|
59
38
|
textAnchor: MUST_USE_ATTRIBUTE,
|
|
60
|
-
transform: MUST_USE_ATTRIBUTE,
|
|
61
|
-
version: MUST_USE_ATTRIBUTE,
|
|
62
|
-
viewBox: MUST_USE_ATTRIBUTE,
|
|
63
|
-
x1: MUST_USE_ATTRIBUTE,
|
|
64
|
-
x2: MUST_USE_ATTRIBUTE,
|
|
65
|
-
x: MUST_USE_ATTRIBUTE,
|
|
66
39
|
xlinkActuate: MUST_USE_ATTRIBUTE,
|
|
67
40
|
xlinkArcrole: MUST_USE_ATTRIBUTE,
|
|
68
41
|
xlinkHref: MUST_USE_ATTRIBUTE,
|
|
@@ -72,10 +45,7 @@ var SVGDOMPropertyConfig = {
|
|
|
72
45
|
xlinkType: MUST_USE_ATTRIBUTE,
|
|
73
46
|
xmlBase: MUST_USE_ATTRIBUTE,
|
|
74
47
|
xmlLang: MUST_USE_ATTRIBUTE,
|
|
75
|
-
xmlSpace: MUST_USE_ATTRIBUTE
|
|
76
|
-
y1: MUST_USE_ATTRIBUTE,
|
|
77
|
-
y2: MUST_USE_ATTRIBUTE,
|
|
78
|
-
y: MUST_USE_ATTRIBUTE
|
|
48
|
+
xmlSpace: MUST_USE_ATTRIBUTE
|
|
79
49
|
},
|
|
80
50
|
DOMAttributeNamespaces: {
|
|
81
51
|
xlinkActuate: NS.xlink,
|
|
@@ -94,15 +64,9 @@ var SVGDOMPropertyConfig = {
|
|
|
94
64
|
fillOpacity: 'fill-opacity',
|
|
95
65
|
fontFamily: 'font-family',
|
|
96
66
|
fontSize: 'font-size',
|
|
97
|
-
gradientTransform: 'gradientTransform',
|
|
98
|
-
gradientUnits: 'gradientUnits',
|
|
99
67
|
markerEnd: 'marker-end',
|
|
100
68
|
markerMid: 'marker-mid',
|
|
101
69
|
markerStart: 'marker-start',
|
|
102
|
-
patternContentUnits: 'patternContentUnits',
|
|
103
|
-
patternUnits: 'patternUnits',
|
|
104
|
-
preserveAspectRatio: 'preserveAspectRatio',
|
|
105
|
-
spreadMethod: 'spreadMethod',
|
|
106
70
|
stopColor: 'stop-color',
|
|
107
71
|
stopOpacity: 'stop-opacity',
|
|
108
72
|
strokeDasharray: 'stroke-dasharray',
|
|
@@ -110,7 +74,6 @@ var SVGDOMPropertyConfig = {
|
|
|
110
74
|
strokeOpacity: 'stroke-opacity',
|
|
111
75
|
strokeWidth: 'stroke-width',
|
|
112
76
|
textAnchor: 'text-anchor',
|
|
113
|
-
viewBox: 'viewBox',
|
|
114
77
|
xlinkActuate: 'xlink:actuate',
|
|
115
78
|
xlinkArcrole: 'xlink:arcrole',
|
|
116
79
|
xlinkHref: 'xlink:href',
|
package/lib/SelectEventPlugin.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
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
var EventConstants = require('./EventConstants');
|
|
15
15
|
var EventPropagators = require('./EventPropagators');
|
|
16
16
|
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
17
|
+
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
17
18
|
var ReactInputSelection = require('./ReactInputSelection');
|
|
18
19
|
var SyntheticEvent = require('./SyntheticEvent');
|
|
19
20
|
|
|
@@ -37,12 +38,12 @@ var eventTypes = {
|
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
var activeElement = null;
|
|
40
|
-
var
|
|
41
|
+
var activeElementInst = null;
|
|
41
42
|
var lastSelection = null;
|
|
42
43
|
var mouseDown = false;
|
|
43
44
|
|
|
44
45
|
// Track whether a listener exists for this plugin. If none exist, we do
|
|
45
|
-
// not extract events.
|
|
46
|
+
// not extract events. See #3639.
|
|
46
47
|
var hasListener = false;
|
|
47
48
|
var ON_SELECT_KEY = keyOf({ onSelect: null });
|
|
48
49
|
|
|
@@ -100,7 +101,7 @@ function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
|
|
100
101
|
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
|
101
102
|
lastSelection = currentSelection;
|
|
102
103
|
|
|
103
|
-
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select,
|
|
104
|
+
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
|
|
104
105
|
|
|
105
106
|
syntheticEvent.type = 'select';
|
|
106
107
|
syntheticEvent.target = activeElement;
|
|
@@ -131,31 +132,25 @@ var SelectEventPlugin = {
|
|
|
131
132
|
|
|
132
133
|
eventTypes: eventTypes,
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
* @param {string} topLevelType Record from `EventConstants`.
|
|
136
|
-
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
|
137
|
-
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
|
138
|
-
* @param {object} nativeEvent Native browser event.
|
|
139
|
-
* @return {*} An accumulation of synthetic events.
|
|
140
|
-
* @see {EventPluginHub.extractEvents}
|
|
141
|
-
*/
|
|
142
|
-
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
|
135
|
+
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
143
136
|
if (!hasListener) {
|
|
144
137
|
return null;
|
|
145
138
|
}
|
|
146
139
|
|
|
140
|
+
var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
|
|
141
|
+
|
|
147
142
|
switch (topLevelType) {
|
|
148
143
|
// Track the input node that has focus.
|
|
149
144
|
case topLevelTypes.topFocus:
|
|
150
|
-
if (isTextInputElement(
|
|
151
|
-
activeElement =
|
|
152
|
-
|
|
145
|
+
if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
|
|
146
|
+
activeElement = targetNode;
|
|
147
|
+
activeElementInst = targetInst;
|
|
153
148
|
lastSelection = null;
|
|
154
149
|
}
|
|
155
150
|
break;
|
|
156
151
|
case topLevelTypes.topBlur:
|
|
157
152
|
activeElement = null;
|
|
158
|
-
|
|
153
|
+
activeElementInst = null;
|
|
159
154
|
lastSelection = null;
|
|
160
155
|
break;
|
|
161
156
|
|
|
@@ -191,7 +186,7 @@ var SelectEventPlugin = {
|
|
|
191
186
|
return null;
|
|
192
187
|
},
|
|
193
188
|
|
|
194
|
-
didPutListener: function (
|
|
189
|
+
didPutListener: function (inst, registrationName, listener) {
|
|
195
190
|
if (registrationName === ON_SELECT_KEY) {
|
|
196
191
|
hasListener = true;
|
|
197
192
|
}
|
package/lib/SimpleEventPlugin.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
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
var EventConstants = require('./EventConstants');
|
|
15
15
|
var EventListener = require('fbjs/lib/EventListener');
|
|
16
16
|
var EventPropagators = require('./EventPropagators');
|
|
17
|
-
var
|
|
17
|
+
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
18
18
|
var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
|
|
19
19
|
var SyntheticEvent = require('./SyntheticEvent');
|
|
20
20
|
var SyntheticFocusEvent = require('./SyntheticFocusEvent');
|
|
@@ -177,6 +177,12 @@ var eventTypes = {
|
|
|
177
177
|
captured: keyOf({ onInputCapture: true })
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
|
+
invalid: {
|
|
181
|
+
phasedRegistrationNames: {
|
|
182
|
+
bubbled: keyOf({ onInvalid: true }),
|
|
183
|
+
captured: keyOf({ onInvalidCapture: true })
|
|
184
|
+
}
|
|
185
|
+
},
|
|
180
186
|
keyDown: {
|
|
181
187
|
phasedRegistrationNames: {
|
|
182
188
|
bubbled: keyOf({ onKeyDown: true }),
|
|
@@ -404,6 +410,7 @@ var topLevelEventsToDispatchConfig = {
|
|
|
404
410
|
topError: eventTypes.error,
|
|
405
411
|
topFocus: eventTypes.focus,
|
|
406
412
|
topInput: eventTypes.input,
|
|
413
|
+
topInvalid: eventTypes.invalid,
|
|
407
414
|
topKeyDown: eventTypes.keyDown,
|
|
408
415
|
topKeyPress: eventTypes.keyPress,
|
|
409
416
|
topKeyUp: eventTypes.keyUp,
|
|
@@ -450,15 +457,7 @@ var SimpleEventPlugin = {
|
|
|
450
457
|
|
|
451
458
|
eventTypes: eventTypes,
|
|
452
459
|
|
|
453
|
-
|
|
454
|
-
* @param {string} topLevelType Record from `EventConstants`.
|
|
455
|
-
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
|
456
|
-
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
|
457
|
-
* @param {object} nativeEvent Native browser event.
|
|
458
|
-
* @return {*} An accumulation of synthetic events.
|
|
459
|
-
* @see {EventPluginHub.extractEvents}
|
|
460
|
-
*/
|
|
461
|
-
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
|
460
|
+
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
462
461
|
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
|
|
463
462
|
if (!dispatchConfig) {
|
|
464
463
|
return null;
|
|
@@ -474,6 +473,7 @@ var SimpleEventPlugin = {
|
|
|
474
473
|
case topLevelTypes.topEnded:
|
|
475
474
|
case topLevelTypes.topError:
|
|
476
475
|
case topLevelTypes.topInput:
|
|
476
|
+
case topLevelTypes.topInvalid:
|
|
477
477
|
case topLevelTypes.topLoad:
|
|
478
478
|
case topLevelTypes.topLoadedData:
|
|
479
479
|
case topLevelTypes.topLoadedMetadata:
|
|
@@ -497,7 +497,7 @@ var SimpleEventPlugin = {
|
|
|
497
497
|
EventConstructor = SyntheticEvent;
|
|
498
498
|
break;
|
|
499
499
|
case topLevelTypes.topKeyPress:
|
|
500
|
-
//
|
|
500
|
+
// Firefox creates a keypress event for function keys too. This removes
|
|
501
501
|
// the unwanted keypress events. Enter is however both printable and
|
|
502
502
|
// non-printable. One would expect Tab to be as well (but it isn't).
|
|
503
503
|
if (getEventCharCode(nativeEvent) === 0) {
|
|
@@ -557,26 +557,28 @@ var SimpleEventPlugin = {
|
|
|
557
557
|
break;
|
|
558
558
|
}
|
|
559
559
|
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
|
560
|
-
var event = EventConstructor.getPooled(dispatchConfig,
|
|
560
|
+
var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
|
|
561
561
|
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
562
562
|
return event;
|
|
563
563
|
},
|
|
564
564
|
|
|
565
|
-
didPutListener: function (
|
|
565
|
+
didPutListener: function (inst, registrationName, listener) {
|
|
566
566
|
// Mobile Safari does not fire properly bubble click events on
|
|
567
567
|
// non-interactive elements, which means delegated click listeners do not
|
|
568
568
|
// fire. The workaround for this bug involves attaching an empty click
|
|
569
569
|
// listener on the target node.
|
|
570
570
|
if (registrationName === ON_CLICK_KEY) {
|
|
571
|
-
var
|
|
571
|
+
var id = inst._rootNodeID;
|
|
572
|
+
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
572
573
|
if (!onClickListeners[id]) {
|
|
573
574
|
onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
|
|
574
575
|
}
|
|
575
576
|
}
|
|
576
577
|
},
|
|
577
578
|
|
|
578
|
-
willDeleteListener: function (
|
|
579
|
+
willDeleteListener: function (inst, registrationName) {
|
|
579
580
|
if (registrationName === ON_CLICK_KEY) {
|
|
581
|
+
var id = inst._rootNodeID;
|
|
580
582
|
onClickListeners[id].remove();
|
|
581
583
|
delete onClickListeners[id];
|
|
582
584
|
}
|
|
@@ -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 SyntheticClipboardEvent
|
|
10
|
-
* @typechecks static-only
|
|
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
|
|
@@ -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 SyntheticCompositionEvent
|
|
10
|
-
* @typechecks static-only
|
|
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
|
|
@@ -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 SyntheticDragEvent
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
package/lib/SyntheticEvent.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 SyntheticEvent
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
|
@@ -51,12 +50,13 @@ var EventInterface = {
|
|
|
51
50
|
* DOM interface; custom application-specific events can also subclass this.
|
|
52
51
|
*
|
|
53
52
|
* @param {object} dispatchConfig Configuration used to dispatch this event.
|
|
54
|
-
* @param {
|
|
53
|
+
* @param {*} targetInst Marker identifying the event target.
|
|
55
54
|
* @param {object} nativeEvent Native browser event.
|
|
55
|
+
* @param {DOMEventTarget} nativeEventTarget Target node.
|
|
56
56
|
*/
|
|
57
|
-
function SyntheticEvent(dispatchConfig,
|
|
57
|
+
function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
|
|
58
58
|
this.dispatchConfig = dispatchConfig;
|
|
59
|
-
this.
|
|
59
|
+
this._targetInst = targetInst;
|
|
60
60
|
this.nativeEvent = nativeEvent;
|
|
61
61
|
|
|
62
62
|
var Interface = this.constructor.Interface;
|
|
@@ -147,7 +147,7 @@ assign(SyntheticEvent.prototype, {
|
|
|
147
147
|
this[propName] = null;
|
|
148
148
|
}
|
|
149
149
|
this.dispatchConfig = null;
|
|
150
|
-
this.
|
|
150
|
+
this._targetInst = null;
|
|
151
151
|
this.nativeEvent = null;
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -164,7 +164,10 @@ SyntheticEvent.Interface = EventInterface;
|
|
|
164
164
|
SyntheticEvent.augmentClass = function (Class, Interface) {
|
|
165
165
|
var Super = this;
|
|
166
166
|
|
|
167
|
-
var
|
|
167
|
+
var E = function () {};
|
|
168
|
+
E.prototype = Super.prototype;
|
|
169
|
+
var prototype = new E();
|
|
170
|
+
|
|
168
171
|
assign(prototype, Class.prototype);
|
|
169
172
|
Class.prototype = prototype;
|
|
170
173
|
Class.prototype.constructor = Class;
|
|
@@ -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 SyntheticFocusEvent
|
|
10
|
-
* @typechecks static-only
|
|
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
|
|
@@ -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 SyntheticInputEvent
|
|
10
|
-
* @typechecks static-only
|
|
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
|
|
@@ -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 SyntheticKeyboardEvent
|
|
10
|
-
* @typechecks static-only
|
|
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
|
|
@@ -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 SyntheticMouseEvent
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|