react 0.13.3 → 0.14.0-beta1
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 +7 -0
- package/dist/JSXTransformer.js +4101 -2432
- package/dist/react-with-addons.js +4389 -6277
- package/dist/react-with-addons.min.js +6 -8
- package/dist/react.js +4028 -5697
- package/dist/react.min.js +5 -6
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +16 -5
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +4 -3
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +26 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +86 -147
- package/lib/DOMPropertyOperations.js +91 -67
- package/lib/Danger.js +19 -62
- package/lib/DefaultEventPluginOrder.js +2 -12
- package/lib/EnterLeaveEventPlugin.js +11 -33
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +11 -13
- package/lib/EventPluginHub.js +44 -47
- package/lib/EventPluginRegistry.js +18 -74
- package/lib/EventPluginUtils.js +33 -44
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +15 -20
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +71 -89
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +20 -11
- package/lib/React.js +9 -129
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +26 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +24 -31
- package/lib/ReactClass.js +96 -267
- package/lib/ReactComponent.js +28 -57
- package/lib/ReactComponentBrowserEnvironment.js +4 -8
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +6 -7
- package/lib/ReactCompositeComponent.js +115 -381
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +16 -28
- package/lib/ReactDOMClient.js +90 -0
- package/lib/ReactDOMComponent.js +468 -156
- package/lib/ReactDOMIDOperations.js +25 -22
- package/lib/ReactDOMInput.js +79 -108
- package/lib/ReactDOMOption.js +58 -20
- package/lib/ReactDOMSelect.js +95 -83
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +44 -69
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +20 -76
- package/lib/ReactDefaultPerf.js +36 -69
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +26 -120
- package/lib/ReactElementValidator.js +56 -192
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +3 -3
- package/lib/ReactEventEmitterMixin.js +3 -13
- package/lib/ReactEventListener.js +58 -40
- package/lib/ReactFragment.js +33 -59
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +14 -23
- package/lib/ReactInstanceHandles.js +29 -58
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +142 -285
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +6 -15
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +7 -24
- package/lib/ReactPerf.js +8 -12
- package/lib/ReactPropTransferer.js +4 -4
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +41 -61
- package/lib/ReactReconcileTransaction.js +11 -36
- package/lib/ReactReconciler.js +14 -26
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +20 -15
- package/lib/ReactServerRenderingTransaction.js +9 -34
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +137 -190
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +69 -107
- package/lib/ReactUpdates.js +26 -81
- package/lib/ReactWithAddons.js +5 -6
- package/lib/SVGDOMPropertyConfig.js +39 -4
- package/lib/SelectEventPlugin.js +31 -33
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +138 -130
- package/lib/SyntheticClipboardEvent.js +5 -9
- package/lib/SyntheticCompositionEvent.js +4 -10
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +14 -15
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +4 -10
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +10 -16
- package/lib/SyntheticTouchEvent.js +3 -3
- package/lib/SyntheticUIEvent.js +5 -5
- package/lib/SyntheticWheelEvent.js +13 -17
- package/lib/Transaction.js +22 -28
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -4
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +6 -12
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/deprecated.js +47 -0
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +7 -27
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +3 -3
- package/lib/getActiveElement.js +4 -2
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +2 -4
- package/lib/getMarkupWrap.js +18 -40
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTextContentAccessor.js +2 -4
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +3 -1
- package/lib/hyphenateStyleName.js +2 -2
- package/lib/instantiateReactComponent.js +23 -43
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +3 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +3 -3
- package/lib/keyMirror.js +3 -6
- package/lib/keyOf.js +4 -3
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +2 -2
- package/lib/onlyChild.js +2 -5
- package/lib/performance.js +2 -5
- package/lib/performanceNow.js +3 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +16 -0
- package/lib/setInnerHTML.js +11 -8
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +24 -0
- package/lib/shallowEqual.js +17 -11
- package/lib/shouldUpdateReactComponent.js +3 -64
- package/lib/toArray.js +8 -19
- package/lib/traverseAllChildren.js +23 -90
- package/lib/update.js +25 -85
- package/lib/validateDOMNesting.js +363 -0
- package/lib/warning.js +15 -17
- package/package.json +3 -3
- package/react.js +53 -1
- package/lib/LocalEventTrapMixin.js +0 -53
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactContext.js +0 -74
- 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/ReactPutListenerQueue.js +0 -54
- package/lib/createFullPageComponent.js +0 -58
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
|
|
22
22
|
|
|
23
23
|
var ServerReactRootIndex = {
|
|
24
|
-
createReactRootIndex: function() {
|
|
24
|
+
createReactRootIndex: function () {
|
|
25
25
|
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
module.exports = ServerReactRootIndex;
|
|
29
|
+
module.exports = ServerReactRootIndex;
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var EventConstants = require("./EventConstants");
|
|
15
|
+
var EventListener = require("./EventListener");
|
|
15
16
|
var EventPluginUtils = require("./EventPluginUtils");
|
|
16
17
|
var EventPropagators = require("./EventPropagators");
|
|
18
|
+
var ReactMount = require("./ReactMount");
|
|
17
19
|
var SyntheticClipboardEvent = require("./SyntheticClipboardEvent");
|
|
18
20
|
var SyntheticEvent = require("./SyntheticEvent");
|
|
19
21
|
var SyntheticFocusEvent = require("./SyntheticFocusEvent");
|
|
@@ -24,8 +26,8 @@ var SyntheticTouchEvent = require("./SyntheticTouchEvent");
|
|
|
24
26
|
var SyntheticUIEvent = require("./SyntheticUIEvent");
|
|
25
27
|
var SyntheticWheelEvent = require("./SyntheticWheelEvent");
|
|
26
28
|
|
|
29
|
+
var emptyFunction = require("./emptyFunction");
|
|
27
30
|
var getEventCharCode = require("./getEventCharCode");
|
|
28
|
-
|
|
29
31
|
var invariant = require("./invariant");
|
|
30
32
|
var keyOf = require("./keyOf");
|
|
31
33
|
var warning = require("./warning");
|
|
@@ -35,260 +37,263 @@ var topLevelTypes = EventConstants.topLevelTypes;
|
|
|
35
37
|
var eventTypes = {
|
|
36
38
|
blur: {
|
|
37
39
|
phasedRegistrationNames: {
|
|
38
|
-
bubbled: keyOf({onBlur: true}),
|
|
39
|
-
captured: keyOf({onBlurCapture: true})
|
|
40
|
+
bubbled: keyOf({ onBlur: true }),
|
|
41
|
+
captured: keyOf({ onBlurCapture: true })
|
|
40
42
|
}
|
|
41
43
|
},
|
|
42
44
|
click: {
|
|
43
45
|
phasedRegistrationNames: {
|
|
44
|
-
bubbled: keyOf({onClick: true}),
|
|
45
|
-
captured: keyOf({onClickCapture: true})
|
|
46
|
+
bubbled: keyOf({ onClick: true }),
|
|
47
|
+
captured: keyOf({ onClickCapture: true })
|
|
46
48
|
}
|
|
47
49
|
},
|
|
48
50
|
contextMenu: {
|
|
49
51
|
phasedRegistrationNames: {
|
|
50
|
-
bubbled: keyOf({onContextMenu: true}),
|
|
51
|
-
captured: keyOf({onContextMenuCapture: true})
|
|
52
|
+
bubbled: keyOf({ onContextMenu: true }),
|
|
53
|
+
captured: keyOf({ onContextMenuCapture: true })
|
|
52
54
|
}
|
|
53
55
|
},
|
|
54
56
|
copy: {
|
|
55
57
|
phasedRegistrationNames: {
|
|
56
|
-
bubbled: keyOf({onCopy: true}),
|
|
57
|
-
captured: keyOf({onCopyCapture: true})
|
|
58
|
+
bubbled: keyOf({ onCopy: true }),
|
|
59
|
+
captured: keyOf({ onCopyCapture: true })
|
|
58
60
|
}
|
|
59
61
|
},
|
|
60
62
|
cut: {
|
|
61
63
|
phasedRegistrationNames: {
|
|
62
|
-
bubbled: keyOf({onCut: true}),
|
|
63
|
-
captured: keyOf({onCutCapture: true})
|
|
64
|
+
bubbled: keyOf({ onCut: true }),
|
|
65
|
+
captured: keyOf({ onCutCapture: true })
|
|
64
66
|
}
|
|
65
67
|
},
|
|
66
68
|
doubleClick: {
|
|
67
69
|
phasedRegistrationNames: {
|
|
68
|
-
bubbled: keyOf({onDoubleClick: true}),
|
|
69
|
-
captured: keyOf({onDoubleClickCapture: true})
|
|
70
|
+
bubbled: keyOf({ onDoubleClick: true }),
|
|
71
|
+
captured: keyOf({ onDoubleClickCapture: true })
|
|
70
72
|
}
|
|
71
73
|
},
|
|
72
74
|
drag: {
|
|
73
75
|
phasedRegistrationNames: {
|
|
74
|
-
bubbled: keyOf({onDrag: true}),
|
|
75
|
-
captured: keyOf({onDragCapture: true})
|
|
76
|
+
bubbled: keyOf({ onDrag: true }),
|
|
77
|
+
captured: keyOf({ onDragCapture: true })
|
|
76
78
|
}
|
|
77
79
|
},
|
|
78
80
|
dragEnd: {
|
|
79
81
|
phasedRegistrationNames: {
|
|
80
|
-
bubbled: keyOf({onDragEnd: true}),
|
|
81
|
-
captured: keyOf({onDragEndCapture: true})
|
|
82
|
+
bubbled: keyOf({ onDragEnd: true }),
|
|
83
|
+
captured: keyOf({ onDragEndCapture: true })
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
86
|
dragEnter: {
|
|
85
87
|
phasedRegistrationNames: {
|
|
86
|
-
bubbled: keyOf({onDragEnter: true}),
|
|
87
|
-
captured: keyOf({onDragEnterCapture: true})
|
|
88
|
+
bubbled: keyOf({ onDragEnter: true }),
|
|
89
|
+
captured: keyOf({ onDragEnterCapture: true })
|
|
88
90
|
}
|
|
89
91
|
},
|
|
90
92
|
dragExit: {
|
|
91
93
|
phasedRegistrationNames: {
|
|
92
|
-
bubbled: keyOf({onDragExit: true}),
|
|
93
|
-
captured: keyOf({onDragExitCapture: true})
|
|
94
|
+
bubbled: keyOf({ onDragExit: true }),
|
|
95
|
+
captured: keyOf({ onDragExitCapture: true })
|
|
94
96
|
}
|
|
95
97
|
},
|
|
96
98
|
dragLeave: {
|
|
97
99
|
phasedRegistrationNames: {
|
|
98
|
-
bubbled: keyOf({onDragLeave: true}),
|
|
99
|
-
captured: keyOf({onDragLeaveCapture: true})
|
|
100
|
+
bubbled: keyOf({ onDragLeave: true }),
|
|
101
|
+
captured: keyOf({ onDragLeaveCapture: true })
|
|
100
102
|
}
|
|
101
103
|
},
|
|
102
104
|
dragOver: {
|
|
103
105
|
phasedRegistrationNames: {
|
|
104
|
-
bubbled: keyOf({onDragOver: true}),
|
|
105
|
-
captured: keyOf({onDragOverCapture: true})
|
|
106
|
+
bubbled: keyOf({ onDragOver: true }),
|
|
107
|
+
captured: keyOf({ onDragOverCapture: true })
|
|
106
108
|
}
|
|
107
109
|
},
|
|
108
110
|
dragStart: {
|
|
109
111
|
phasedRegistrationNames: {
|
|
110
|
-
bubbled: keyOf({onDragStart: true}),
|
|
111
|
-
captured: keyOf({onDragStartCapture: true})
|
|
112
|
+
bubbled: keyOf({ onDragStart: true }),
|
|
113
|
+
captured: keyOf({ onDragStartCapture: true })
|
|
112
114
|
}
|
|
113
115
|
},
|
|
114
116
|
drop: {
|
|
115
117
|
phasedRegistrationNames: {
|
|
116
|
-
bubbled: keyOf({onDrop: true}),
|
|
117
|
-
captured: keyOf({onDropCapture: true})
|
|
118
|
+
bubbled: keyOf({ onDrop: true }),
|
|
119
|
+
captured: keyOf({ onDropCapture: true })
|
|
118
120
|
}
|
|
119
121
|
},
|
|
120
122
|
focus: {
|
|
121
123
|
phasedRegistrationNames: {
|
|
122
|
-
bubbled: keyOf({onFocus: true}),
|
|
123
|
-
captured: keyOf({onFocusCapture: true})
|
|
124
|
+
bubbled: keyOf({ onFocus: true }),
|
|
125
|
+
captured: keyOf({ onFocusCapture: true })
|
|
124
126
|
}
|
|
125
127
|
},
|
|
126
128
|
input: {
|
|
127
129
|
phasedRegistrationNames: {
|
|
128
|
-
bubbled: keyOf({onInput: true}),
|
|
129
|
-
captured: keyOf({onInputCapture: true})
|
|
130
|
+
bubbled: keyOf({ onInput: true }),
|
|
131
|
+
captured: keyOf({ onInputCapture: true })
|
|
130
132
|
}
|
|
131
133
|
},
|
|
132
134
|
keyDown: {
|
|
133
135
|
phasedRegistrationNames: {
|
|
134
|
-
bubbled: keyOf({onKeyDown: true}),
|
|
135
|
-
captured: keyOf({onKeyDownCapture: true})
|
|
136
|
+
bubbled: keyOf({ onKeyDown: true }),
|
|
137
|
+
captured: keyOf({ onKeyDownCapture: true })
|
|
136
138
|
}
|
|
137
139
|
},
|
|
138
140
|
keyPress: {
|
|
139
141
|
phasedRegistrationNames: {
|
|
140
|
-
bubbled: keyOf({onKeyPress: true}),
|
|
141
|
-
captured: keyOf({onKeyPressCapture: true})
|
|
142
|
+
bubbled: keyOf({ onKeyPress: true }),
|
|
143
|
+
captured: keyOf({ onKeyPressCapture: true })
|
|
142
144
|
}
|
|
143
145
|
},
|
|
144
146
|
keyUp: {
|
|
145
147
|
phasedRegistrationNames: {
|
|
146
|
-
bubbled: keyOf({onKeyUp: true}),
|
|
147
|
-
captured: keyOf({onKeyUpCapture: true})
|
|
148
|
+
bubbled: keyOf({ onKeyUp: true }),
|
|
149
|
+
captured: keyOf({ onKeyUpCapture: true })
|
|
148
150
|
}
|
|
149
151
|
},
|
|
150
152
|
load: {
|
|
151
153
|
phasedRegistrationNames: {
|
|
152
|
-
bubbled: keyOf({onLoad: true}),
|
|
153
|
-
captured: keyOf({onLoadCapture: true})
|
|
154
|
+
bubbled: keyOf({ onLoad: true }),
|
|
155
|
+
captured: keyOf({ onLoadCapture: true })
|
|
154
156
|
}
|
|
155
157
|
},
|
|
156
158
|
error: {
|
|
157
159
|
phasedRegistrationNames: {
|
|
158
|
-
bubbled: keyOf({onError: true}),
|
|
159
|
-
captured: keyOf({onErrorCapture: true})
|
|
160
|
+
bubbled: keyOf({ onError: true }),
|
|
161
|
+
captured: keyOf({ onErrorCapture: true })
|
|
160
162
|
}
|
|
161
163
|
},
|
|
162
164
|
// Note: We do not allow listening to mouseOver events. Instead, use the
|
|
163
165
|
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
|
|
164
166
|
mouseDown: {
|
|
165
167
|
phasedRegistrationNames: {
|
|
166
|
-
bubbled: keyOf({onMouseDown: true}),
|
|
167
|
-
captured: keyOf({onMouseDownCapture: true})
|
|
168
|
+
bubbled: keyOf({ onMouseDown: true }),
|
|
169
|
+
captured: keyOf({ onMouseDownCapture: true })
|
|
168
170
|
}
|
|
169
171
|
},
|
|
170
172
|
mouseMove: {
|
|
171
173
|
phasedRegistrationNames: {
|
|
172
|
-
bubbled: keyOf({onMouseMove: true}),
|
|
173
|
-
captured: keyOf({onMouseMoveCapture: true})
|
|
174
|
+
bubbled: keyOf({ onMouseMove: true }),
|
|
175
|
+
captured: keyOf({ onMouseMoveCapture: true })
|
|
174
176
|
}
|
|
175
177
|
},
|
|
176
178
|
mouseOut: {
|
|
177
179
|
phasedRegistrationNames: {
|
|
178
|
-
bubbled: keyOf({onMouseOut: true}),
|
|
179
|
-
captured: keyOf({onMouseOutCapture: true})
|
|
180
|
+
bubbled: keyOf({ onMouseOut: true }),
|
|
181
|
+
captured: keyOf({ onMouseOutCapture: true })
|
|
180
182
|
}
|
|
181
183
|
},
|
|
182
184
|
mouseOver: {
|
|
183
185
|
phasedRegistrationNames: {
|
|
184
|
-
bubbled: keyOf({onMouseOver: true}),
|
|
185
|
-
captured: keyOf({onMouseOverCapture: true})
|
|
186
|
+
bubbled: keyOf({ onMouseOver: true }),
|
|
187
|
+
captured: keyOf({ onMouseOverCapture: true })
|
|
186
188
|
}
|
|
187
189
|
},
|
|
188
190
|
mouseUp: {
|
|
189
191
|
phasedRegistrationNames: {
|
|
190
|
-
bubbled: keyOf({onMouseUp: true}),
|
|
191
|
-
captured: keyOf({onMouseUpCapture: true})
|
|
192
|
+
bubbled: keyOf({ onMouseUp: true }),
|
|
193
|
+
captured: keyOf({ onMouseUpCapture: true })
|
|
192
194
|
}
|
|
193
195
|
},
|
|
194
196
|
paste: {
|
|
195
197
|
phasedRegistrationNames: {
|
|
196
|
-
bubbled: keyOf({onPaste: true}),
|
|
197
|
-
captured: keyOf({onPasteCapture: true})
|
|
198
|
+
bubbled: keyOf({ onPaste: true }),
|
|
199
|
+
captured: keyOf({ onPasteCapture: true })
|
|
198
200
|
}
|
|
199
201
|
},
|
|
200
202
|
reset: {
|
|
201
203
|
phasedRegistrationNames: {
|
|
202
|
-
bubbled: keyOf({onReset: true}),
|
|
203
|
-
captured: keyOf({onResetCapture: true})
|
|
204
|
+
bubbled: keyOf({ onReset: true }),
|
|
205
|
+
captured: keyOf({ onResetCapture: true })
|
|
204
206
|
}
|
|
205
207
|
},
|
|
206
208
|
scroll: {
|
|
207
209
|
phasedRegistrationNames: {
|
|
208
|
-
bubbled: keyOf({onScroll: true}),
|
|
209
|
-
captured: keyOf({onScrollCapture: true})
|
|
210
|
+
bubbled: keyOf({ onScroll: true }),
|
|
211
|
+
captured: keyOf({ onScrollCapture: true })
|
|
210
212
|
}
|
|
211
213
|
},
|
|
212
214
|
submit: {
|
|
213
215
|
phasedRegistrationNames: {
|
|
214
|
-
bubbled: keyOf({onSubmit: true}),
|
|
215
|
-
captured: keyOf({onSubmitCapture: true})
|
|
216
|
+
bubbled: keyOf({ onSubmit: true }),
|
|
217
|
+
captured: keyOf({ onSubmitCapture: true })
|
|
216
218
|
}
|
|
217
219
|
},
|
|
218
220
|
touchCancel: {
|
|
219
221
|
phasedRegistrationNames: {
|
|
220
|
-
bubbled: keyOf({onTouchCancel: true}),
|
|
221
|
-
captured: keyOf({onTouchCancelCapture: true})
|
|
222
|
+
bubbled: keyOf({ onTouchCancel: true }),
|
|
223
|
+
captured: keyOf({ onTouchCancelCapture: true })
|
|
222
224
|
}
|
|
223
225
|
},
|
|
224
226
|
touchEnd: {
|
|
225
227
|
phasedRegistrationNames: {
|
|
226
|
-
bubbled: keyOf({onTouchEnd: true}),
|
|
227
|
-
captured: keyOf({onTouchEndCapture: true})
|
|
228
|
+
bubbled: keyOf({ onTouchEnd: true }),
|
|
229
|
+
captured: keyOf({ onTouchEndCapture: true })
|
|
228
230
|
}
|
|
229
231
|
},
|
|
230
232
|
touchMove: {
|
|
231
233
|
phasedRegistrationNames: {
|
|
232
|
-
bubbled: keyOf({onTouchMove: true}),
|
|
233
|
-
captured: keyOf({onTouchMoveCapture: true})
|
|
234
|
+
bubbled: keyOf({ onTouchMove: true }),
|
|
235
|
+
captured: keyOf({ onTouchMoveCapture: true })
|
|
234
236
|
}
|
|
235
237
|
},
|
|
236
238
|
touchStart: {
|
|
237
239
|
phasedRegistrationNames: {
|
|
238
|
-
bubbled: keyOf({onTouchStart: true}),
|
|
239
|
-
captured: keyOf({onTouchStartCapture: true})
|
|
240
|
+
bubbled: keyOf({ onTouchStart: true }),
|
|
241
|
+
captured: keyOf({ onTouchStartCapture: true })
|
|
240
242
|
}
|
|
241
243
|
},
|
|
242
244
|
wheel: {
|
|
243
245
|
phasedRegistrationNames: {
|
|
244
|
-
bubbled: keyOf({onWheel: true}),
|
|
245
|
-
captured: keyOf({onWheelCapture: true})
|
|
246
|
+
bubbled: keyOf({ onWheel: true }),
|
|
247
|
+
captured: keyOf({ onWheelCapture: true })
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
250
|
};
|
|
249
251
|
|
|
250
252
|
var topLevelEventsToDispatchConfig = {
|
|
251
|
-
topBlur:
|
|
252
|
-
topClick:
|
|
253
|
+
topBlur: eventTypes.blur,
|
|
254
|
+
topClick: eventTypes.click,
|
|
253
255
|
topContextMenu: eventTypes.contextMenu,
|
|
254
|
-
topCopy:
|
|
255
|
-
topCut:
|
|
256
|
+
topCopy: eventTypes.copy,
|
|
257
|
+
topCut: eventTypes.cut,
|
|
256
258
|
topDoubleClick: eventTypes.doubleClick,
|
|
257
|
-
topDrag:
|
|
258
|
-
topDragEnd:
|
|
259
|
-
topDragEnter:
|
|
260
|
-
topDragExit:
|
|
261
|
-
topDragLeave:
|
|
262
|
-
topDragOver:
|
|
263
|
-
topDragStart:
|
|
264
|
-
topDrop:
|
|
265
|
-
topError:
|
|
266
|
-
topFocus:
|
|
267
|
-
topInput:
|
|
268
|
-
topKeyDown:
|
|
269
|
-
topKeyPress:
|
|
270
|
-
topKeyUp:
|
|
271
|
-
topLoad:
|
|
272
|
-
topMouseDown:
|
|
273
|
-
topMouseMove:
|
|
274
|
-
topMouseOut:
|
|
275
|
-
topMouseOver:
|
|
276
|
-
topMouseUp:
|
|
277
|
-
topPaste:
|
|
278
|
-
topReset:
|
|
279
|
-
topScroll:
|
|
280
|
-
topSubmit:
|
|
259
|
+
topDrag: eventTypes.drag,
|
|
260
|
+
topDragEnd: eventTypes.dragEnd,
|
|
261
|
+
topDragEnter: eventTypes.dragEnter,
|
|
262
|
+
topDragExit: eventTypes.dragExit,
|
|
263
|
+
topDragLeave: eventTypes.dragLeave,
|
|
264
|
+
topDragOver: eventTypes.dragOver,
|
|
265
|
+
topDragStart: eventTypes.dragStart,
|
|
266
|
+
topDrop: eventTypes.drop,
|
|
267
|
+
topError: eventTypes.error,
|
|
268
|
+
topFocus: eventTypes.focus,
|
|
269
|
+
topInput: eventTypes.input,
|
|
270
|
+
topKeyDown: eventTypes.keyDown,
|
|
271
|
+
topKeyPress: eventTypes.keyPress,
|
|
272
|
+
topKeyUp: eventTypes.keyUp,
|
|
273
|
+
topLoad: eventTypes.load,
|
|
274
|
+
topMouseDown: eventTypes.mouseDown,
|
|
275
|
+
topMouseMove: eventTypes.mouseMove,
|
|
276
|
+
topMouseOut: eventTypes.mouseOut,
|
|
277
|
+
topMouseOver: eventTypes.mouseOver,
|
|
278
|
+
topMouseUp: eventTypes.mouseUp,
|
|
279
|
+
topPaste: eventTypes.paste,
|
|
280
|
+
topReset: eventTypes.reset,
|
|
281
|
+
topScroll: eventTypes.scroll,
|
|
282
|
+
topSubmit: eventTypes.submit,
|
|
281
283
|
topTouchCancel: eventTypes.touchCancel,
|
|
282
|
-
topTouchEnd:
|
|
283
|
-
topTouchMove:
|
|
284
|
-
topTouchStart:
|
|
285
|
-
topWheel:
|
|
284
|
+
topTouchEnd: eventTypes.touchEnd,
|
|
285
|
+
topTouchMove: eventTypes.touchMove,
|
|
286
|
+
topTouchStart: eventTypes.touchStart,
|
|
287
|
+
topWheel: eventTypes.wheel
|
|
286
288
|
};
|
|
287
289
|
|
|
288
290
|
for (var type in topLevelEventsToDispatchConfig) {
|
|
289
291
|
topLevelEventsToDispatchConfig[type].dependencies = [type];
|
|
290
292
|
}
|
|
291
293
|
|
|
294
|
+
var ON_CLICK_KEY = keyOf({ onClick: null });
|
|
295
|
+
var onClickListeners = {};
|
|
296
|
+
|
|
292
297
|
var SimpleEventPlugin = {
|
|
293
298
|
|
|
294
299
|
eventTypes: eventTypes,
|
|
@@ -297,19 +302,14 @@ var SimpleEventPlugin = {
|
|
|
297
302
|
* Same as the default implementation, except cancels the event when return
|
|
298
303
|
* value is false. This behavior will be disabled in a future release.
|
|
299
304
|
*
|
|
300
|
-
* @param {object} Event to be dispatched.
|
|
301
|
-
* @param {function} Application-level callback.
|
|
305
|
+
* @param {object} event Event to be dispatched.
|
|
306
|
+
* @param {function} listener Application-level callback.
|
|
302
307
|
* @param {string} domID DOM ID to pass to the callback.
|
|
303
308
|
*/
|
|
304
|
-
executeDispatch: function(event, listener, domID) {
|
|
309
|
+
executeDispatch: function (event, listener, domID) {
|
|
305
310
|
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
|
|
306
311
|
|
|
307
|
-
|
|
308
|
-
typeof returnValue !== 'boolean',
|
|
309
|
-
'Returning `false` from an event handler is deprecated and will be ' +
|
|
310
|
-
'ignored in a future release. Instead, manually call ' +
|
|
311
|
-
'e.stopPropagation() or e.preventDefault(), as appropriate.'
|
|
312
|
-
) : null);
|
|
312
|
+
'production' !== process.env.NODE_ENV ? warning(typeof returnValue !== 'boolean', 'Returning `false` from an event handler is deprecated and will be ' + 'ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.') : undefined;
|
|
313
313
|
|
|
314
314
|
if (returnValue === false) {
|
|
315
315
|
event.stopPropagation();
|
|
@@ -325,11 +325,7 @@ var SimpleEventPlugin = {
|
|
|
325
325
|
* @return {*} An accumulation of synthetic events.
|
|
326
326
|
* @see {EventPluginHub.extractEvents}
|
|
327
327
|
*/
|
|
328
|
-
extractEvents: function(
|
|
329
|
-
topLevelType,
|
|
330
|
-
topLevelTarget,
|
|
331
|
-
topLevelTargetID,
|
|
332
|
-
nativeEvent) {
|
|
328
|
+
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
|
333
329
|
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
|
|
334
330
|
if (!dispatchConfig) {
|
|
335
331
|
return null;
|
|
@@ -352,7 +348,7 @@ var SimpleEventPlugin = {
|
|
|
352
348
|
if (getEventCharCode(nativeEvent) === 0) {
|
|
353
349
|
return null;
|
|
354
350
|
}
|
|
355
|
-
|
|
351
|
+
/* falls through */
|
|
356
352
|
case topLevelTypes.topKeyDown:
|
|
357
353
|
case topLevelTypes.topKeyUp:
|
|
358
354
|
EventConstructor = SyntheticKeyboardEvent;
|
|
@@ -367,7 +363,7 @@ var SimpleEventPlugin = {
|
|
|
367
363
|
if (nativeEvent.button === 2) {
|
|
368
364
|
return null;
|
|
369
365
|
}
|
|
370
|
-
|
|
366
|
+
/* falls through */
|
|
371
367
|
case topLevelTypes.topContextMenu:
|
|
372
368
|
case topLevelTypes.topDoubleClick:
|
|
373
369
|
case topLevelTypes.topMouseDown:
|
|
@@ -405,20 +401,32 @@ var SimpleEventPlugin = {
|
|
|
405
401
|
EventConstructor = SyntheticClipboardEvent;
|
|
406
402
|
break;
|
|
407
403
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
'SimpleEventPlugin: Unhandled event type, `%s`.',
|
|
411
|
-
topLevelType
|
|
412
|
-
) : invariant(EventConstructor));
|
|
413
|
-
var event = EventConstructor.getPooled(
|
|
414
|
-
dispatchConfig,
|
|
415
|
-
topLevelTargetID,
|
|
416
|
-
nativeEvent
|
|
417
|
-
);
|
|
404
|
+
!EventConstructor ? 'production' !== process.env.NODE_ENV ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
|
405
|
+
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
|
|
418
406
|
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
419
407
|
return event;
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
didPutListener: function (id, registrationName, listener) {
|
|
411
|
+
// Mobile Safari does not fire properly bubble click events on
|
|
412
|
+
// non-interactive elements, which means delegated click listeners do not
|
|
413
|
+
// fire. The workaround for this bug involves attaching an empty click
|
|
414
|
+
// listener on the target node.
|
|
415
|
+
if (registrationName === ON_CLICK_KEY) {
|
|
416
|
+
var node = ReactMount.getNode(id);
|
|
417
|
+
if (!onClickListeners[id]) {
|
|
418
|
+
onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
|
|
423
|
+
willDeleteListener: function (id, registrationName) {
|
|
424
|
+
if (registrationName === ON_CLICK_KEY) {
|
|
425
|
+
onClickListeners[id].remove();
|
|
426
|
+
delete onClickListeners[id];
|
|
427
|
+
}
|
|
420
428
|
}
|
|
421
429
|
|
|
422
430
|
};
|
|
423
431
|
|
|
424
|
-
module.exports = SimpleEventPlugin;
|
|
432
|
+
module.exports = SimpleEventPlugin;
|