react 15.3.2 → 15.4.0-rc.4

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.
Files changed (210) hide show
  1. package/dist/react-with-addons.js +3864 -21390
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/shallowCompare.js +1 -2
  52. package/lib/sliceChildren.js +0 -1
  53. package/lib/traverseAllChildren.js +11 -3
  54. package/lib/update.js +6 -8
  55. package/package.json +1 -1
  56. package/lib/AutoFocusUtils.js +0 -24
  57. package/lib/BeforeInputEventPlugin.js +0 -390
  58. package/lib/CSSProperty.js +0 -148
  59. package/lib/CSSPropertyOperations.js +0 -205
  60. package/lib/CallbackQueue.js +0 -106
  61. package/lib/ChangeEventPlugin.js +0 -325
  62. package/lib/DOMChildrenOperations.js +0 -194
  63. package/lib/DOMLazyTree.js +0 -118
  64. package/lib/DOMProperty.js +0 -206
  65. package/lib/DOMPropertyOperations.js +0 -221
  66. package/lib/Danger.js +0 -48
  67. package/lib/DefaultEventPluginOrder.js +0 -27
  68. package/lib/DisabledInputUtils.js +0 -50
  69. package/lib/EnterLeaveEventPlugin.js +0 -105
  70. package/lib/EventConstants.js +0 -97
  71. package/lib/EventPluginHub.js +0 -251
  72. package/lib/EventPluginRegistry.js +0 -247
  73. package/lib/EventPluginUtils.js +0 -229
  74. package/lib/EventPropagators.js +0 -137
  75. package/lib/FallbackCompositionState.js +0 -95
  76. package/lib/HTMLDOMPropertyConfig.js +0 -212
  77. package/lib/LinkedValueUtils.js +0 -136
  78. package/lib/NativeMethodsMixin.js +0 -167
  79. package/lib/ReactBrowserEventEmitter.js +0 -330
  80. package/lib/ReactChildReconciler.js +0 -154
  81. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  82. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  83. package/lib/ReactComponentEnvironment.js +0 -45
  84. package/lib/ReactComponentTreeTestUtils.js +0 -87
  85. package/lib/ReactCompositeComponent.js +0 -904
  86. package/lib/ReactDOM.js +0 -110
  87. package/lib/ReactDOMButton.js +0 -24
  88. package/lib/ReactDOMComponent.js +0 -1006
  89. package/lib/ReactDOMComponentTree.js +0 -188
  90. package/lib/ReactDOMContainerInfo.js +0 -33
  91. package/lib/ReactDOMEmptyComponent.js +0 -60
  92. package/lib/ReactDOMFiber.js +0 -76
  93. package/lib/ReactDOMIDOperations.js +0 -34
  94. package/lib/ReactDOMInput.js +0 -269
  95. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  96. package/lib/ReactDOMOption.js +0 -123
  97. package/lib/ReactDOMSelect.js +0 -201
  98. package/lib/ReactDOMSelection.js +0 -212
  99. package/lib/ReactDOMServer.js +0 -26
  100. package/lib/ReactDOMTextComponent.js +0 -164
  101. package/lib/ReactDOMTextarea.js +0 -155
  102. package/lib/ReactDOMTreeTraversal.js +0 -136
  103. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  104. package/lib/ReactDebugTool.js +0 -301
  105. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  106. package/lib/ReactDefaultInjection.js +0 -84
  107. package/lib/ReactEmptyComponent.js +0 -30
  108. package/lib/ReactErrorUtils.js +0 -76
  109. package/lib/ReactEventEmitterMixin.js +0 -33
  110. package/lib/ReactEventListener.js +0 -157
  111. package/lib/ReactFeatureFlags.js +0 -22
  112. package/lib/ReactHostComponent.js +0 -76
  113. package/lib/ReactHostOperationHistoryHook.js +0 -37
  114. package/lib/ReactInjection.js +0 -36
  115. package/lib/ReactInputSelection.js +0 -124
  116. package/lib/ReactInstanceHandles.js +0 -302
  117. package/lib/ReactInstanceMap.js +0 -48
  118. package/lib/ReactInstrumentation.js +0 -21
  119. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  120. package/lib/ReactMarkupChecksum.js +0 -50
  121. package/lib/ReactMount.js +0 -534
  122. package/lib/ReactMultiChild.js +0 -451
  123. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  124. package/lib/ReactNative.js +0 -71
  125. package/lib/ReactNativeAttributePayload.js +0 -371
  126. package/lib/ReactNativeBaseComponent.js +0 -198
  127. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  128. package/lib/ReactNativeComponentEnvironment.js +0 -31
  129. package/lib/ReactNativeComponentTree.js +0 -68
  130. package/lib/ReactNativeContainerInfo.js +0 -21
  131. package/lib/ReactNativeDOMIDOperations.js +0 -79
  132. package/lib/ReactNativeDefaultInjection.js +0 -101
  133. package/lib/ReactNativeEventEmitter.js +0 -191
  134. package/lib/ReactNativeEventPluginOrder.js +0 -16
  135. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  136. package/lib/ReactNativeMount.js +0 -193
  137. package/lib/ReactNativePropRegistry.js +0 -52
  138. package/lib/ReactNativeReconcileTransaction.js +0 -129
  139. package/lib/ReactNativeTagHandles.js +0 -56
  140. package/lib/ReactNativeTextComponent.js +0 -71
  141. package/lib/ReactNativeTreeTraversal.js +0 -127
  142. package/lib/ReactNodeTypes.js +0 -40
  143. package/lib/ReactNoop.js +0 -173
  144. package/lib/ReactOwner.js +0 -94
  145. package/lib/ReactPerf.js +0 -494
  146. package/lib/ReactReconcileTransaction.js +0 -178
  147. package/lib/ReactReconciler.js +0 -168
  148. package/lib/ReactRef.js +0 -80
  149. package/lib/ReactServerBatchingStrategy.js +0 -22
  150. package/lib/ReactServerRendering.js +0 -90
  151. package/lib/ReactServerRenderingTransaction.js +0 -90
  152. package/lib/ReactServerUpdateQueue.js +0 -141
  153. package/lib/ReactSimpleEmptyComponent.js +0 -37
  154. package/lib/ReactTestMount.js +0 -126
  155. package/lib/ReactTestReconcileTransaction.js +0 -121
  156. package/lib/ReactTestRenderer.js +0 -144
  157. package/lib/ReactTestUtils.js +0 -518
  158. package/lib/ReactUpdateQueue.js +0 -226
  159. package/lib/ReactUpdates.js +0 -251
  160. package/lib/ResponderEventPlugin.js +0 -510
  161. package/lib/ResponderSyntheticEvent.js +0 -39
  162. package/lib/ResponderTouchHistoryStore.js +0 -184
  163. package/lib/SVGDOMPropertyConfig.js +0 -302
  164. package/lib/SelectEventPlugin.js +0 -196
  165. package/lib/SimpleEventPlugin.js +0 -635
  166. package/lib/SyntheticAnimationEvent.js +0 -39
  167. package/lib/SyntheticClipboardEvent.js +0 -38
  168. package/lib/SyntheticCompositionEvent.js +0 -36
  169. package/lib/SyntheticDragEvent.js +0 -36
  170. package/lib/SyntheticEvent.js +0 -268
  171. package/lib/SyntheticFocusEvent.js +0 -36
  172. package/lib/SyntheticInputEvent.js +0 -37
  173. package/lib/SyntheticKeyboardEvent.js +0 -84
  174. package/lib/SyntheticMouseEvent.js +0 -72
  175. package/lib/SyntheticTouchEvent.js +0 -45
  176. package/lib/SyntheticTransitionEvent.js +0 -39
  177. package/lib/SyntheticUIEvent.js +0 -59
  178. package/lib/SyntheticWheelEvent.js +0 -54
  179. package/lib/TapEventPlugin.js +0 -110
  180. package/lib/TouchHistoryMath.js +0 -99
  181. package/lib/Transaction.js +0 -233
  182. package/lib/ViewportMetrics.js +0 -27
  183. package/lib/accumulate.js +0 -46
  184. package/lib/accumulateInto.js +0 -58
  185. package/lib/adler32.js +0 -44
  186. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  187. package/lib/createReactNativeComponentClass.js +0 -42
  188. package/lib/dangerousStyleValue.js +0 -79
  189. package/lib/escapeTextContentForBrowser.js +0 -123
  190. package/lib/findDOMNode.js +0 -60
  191. package/lib/findNodeHandle.js +0 -91
  192. package/lib/forEachAccumulated.js +0 -31
  193. package/lib/getEventCharCode.js +0 -50
  194. package/lib/getEventKey.js +0 -102
  195. package/lib/getEventModifierState.js +0 -43
  196. package/lib/getEventTarget.js +0 -35
  197. package/lib/getHostComponentFromComposite.js +0 -30
  198. package/lib/getNodeForCharacterOffset.js +0 -74
  199. package/lib/getTestDocument.js +0 -21
  200. package/lib/getTextContentAccessor.js +0 -33
  201. package/lib/getVendorPrefixedEventName.js +0 -101
  202. package/lib/instantiateReactComponent.js +0 -119
  203. package/lib/isEventSupported.js +0 -60
  204. package/lib/isTextInputElement.js +0 -51
  205. package/lib/quoteAttributeValueForBrowser.js +0 -26
  206. package/lib/reactComponentExpect.js +0 -217
  207. package/lib/setInnerHTML.js +0 -98
  208. package/lib/setTextContent.js +0 -48
  209. package/lib/shouldUpdateReactComponent.js +0 -42
  210. package/lib/validateDOMNesting.js +0 -382
@@ -1,167 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-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 NativeMethodsMixin
10
- *
11
- */
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var ReactNativeAttributePayload = require('./ReactNativeAttributePayload');
17
- var TextInputState = require('react-native/lib/TextInputState');
18
- var UIManager = require('react-native/lib/UIManager');
19
-
20
- var findNodeHandle = require('./findNodeHandle');
21
- var invariant = require('fbjs/lib/invariant');
22
-
23
- function warnForStyleProps(props, validAttributes) {
24
- for (var key in validAttributes.style) {
25
- if (!(validAttributes[key] || props[key] === undefined)) {
26
- console.error('You are setting the style `{ ' + key + ': ... }` as a prop. You ' + 'should nest it in a style object. ' + 'E.g. `{ style: { ' + key + ': ... } }`');
27
- }
28
- }
29
- }
30
-
31
- /**
32
- * `NativeMethodsMixin` provides methods to access the underlying native
33
- * component directly. This can be useful in cases when you want to focus
34
- * a view or measure its on-screen dimensions, for example.
35
- *
36
- * The methods described here are available on most of the default components
37
- * provided by React Native. Note, however, that they are *not* available on
38
- * composite components that aren't directly backed by a native view. This will
39
- * generally include most components that you define in your own app. For more
40
- * information, see [Direct
41
- * Manipulation](docs/direct-manipulation.html).
42
- */
43
- var NativeMethodsMixin = {
44
- /**
45
- * Determines the location on screen, width, and height of the given view and
46
- * returns the values via an async callback. If successful, the callback will
47
- * be called with the following arguments:
48
- *
49
- * - x
50
- * - y
51
- * - width
52
- * - height
53
- * - pageX
54
- * - pageY
55
- *
56
- * Note that these measurements are not available until after the rendering
57
- * has been completed in native. If you need the measurements as soon as
58
- * possible, consider using the [`onLayout`
59
- * prop](docs/view.html#onlayout) instead.
60
- */
61
- measure: function (callback) {
62
- UIManager.measure(findNodeHandle(this), mountSafeCallback(this, callback));
63
- },
64
-
65
- /**
66
- * Determines the location of the given view in the window and returns the
67
- * values via an async callback. If the React root view is embedded in
68
- * another native view, this will give you the absolute coordinates. If
69
- * successful, the callback will be called with the following
70
- * arguments:
71
- *
72
- * - x
73
- * - y
74
- * - width
75
- * - height
76
- *
77
- * Note that these measurements are not available until after the rendering
78
- * has been completed in native.
79
- */
80
- measureInWindow: function (callback) {
81
- UIManager.measureInWindow(findNodeHandle(this), mountSafeCallback(this, callback));
82
- },
83
-
84
- /**
85
- * Like [`measure()`](#measure), but measures the view relative an ancestor,
86
- * specified as `relativeToNativeNode`. This means that the returned x, y
87
- * are relative to the origin x, y of the ancestor view.
88
- *
89
- * As always, to obtain a native node handle for a component, you can use
90
- * `React.findNodeHandle(component)`.
91
- */
92
- measureLayout: function (relativeToNativeNode, onSuccess, onFail /* currently unused */
93
- ) {
94
- UIManager.measureLayout(findNodeHandle(this), relativeToNativeNode, mountSafeCallback(this, onFail), mountSafeCallback(this, onSuccess));
95
- },
96
-
97
- /**
98
- * This function sends props straight to native. They will not participate in
99
- * future diff process - this means that if you do not include them in the
100
- * next render, they will remain active (see [Direct
101
- * Manipulation](docs/direct-manipulation.html)).
102
- */
103
- setNativeProps: function (nativeProps) {
104
- if (process.env.NODE_ENV !== 'production') {
105
- warnForStyleProps(nativeProps, this.viewConfig.validAttributes);
106
- }
107
-
108
- var updatePayload = ReactNativeAttributePayload.create(nativeProps, this.viewConfig.validAttributes);
109
-
110
- UIManager.updateView(findNodeHandle(this), this.viewConfig.uiViewClassName, updatePayload);
111
- },
112
-
113
- /**
114
- * Requests focus for the given input or view. The exact behavior triggered
115
- * will depend on the platform and type of view.
116
- */
117
- focus: function () {
118
- TextInputState.focusTextInput(findNodeHandle(this));
119
- },
120
-
121
- /**
122
- * Removes focus from an input or view. This is the opposite of `focus()`.
123
- */
124
- blur: function () {
125
- TextInputState.blurTextInput(findNodeHandle(this));
126
- }
127
- };
128
-
129
- function throwOnStylesProp(component, props) {
130
- if (props.styles !== undefined) {
131
- var owner = component._owner || null;
132
- var name = component.constructor.displayName;
133
- var msg = '`styles` is not a supported property of `' + name + '`, did ' + 'you mean `style` (singular)?';
134
- if (owner && owner.constructor && owner.constructor.displayName) {
135
- msg += '\n\nCheck the `' + owner.constructor.displayName + '` parent ' + ' component.';
136
- }
137
- throw new Error(msg);
138
- }
139
- }
140
- if (process.env.NODE_ENV !== 'production') {
141
- // hide this from Flow since we can't define these properties outside of
142
- // __DEV__ without actually implementing them (setting them to undefined
143
- // isn't allowed by ReactClass)
144
- var NativeMethodsMixin_DEV = NativeMethodsMixin;
145
- !(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Do not override existing functions.') : _prodInvariant('16') : void 0;
146
- NativeMethodsMixin_DEV.componentWillMount = function () {
147
- throwOnStylesProp(this, this.props);
148
- };
149
- NativeMethodsMixin_DEV.componentWillReceiveProps = function (newProps) {
150
- throwOnStylesProp(this, newProps);
151
- };
152
- }
153
-
154
- /**
155
- * In the future, we should cleanup callbacks by cancelling them instead of
156
- * using this.
157
- */
158
- function mountSafeCallback(context, callback) {
159
- return function () {
160
- if (!callback || context.isMounted && !context.isMounted()) {
161
- return undefined;
162
- }
163
- return callback.apply(context, arguments);
164
- };
165
- }
166
-
167
- module.exports = NativeMethodsMixin;
@@ -1,330 +0,0 @@
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 ReactBrowserEventEmitter
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var EventConstants = require('./EventConstants');
17
- var EventPluginRegistry = require('./EventPluginRegistry');
18
- var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
19
- var ViewportMetrics = require('./ViewportMetrics');
20
-
21
- var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
22
- var isEventSupported = require('./isEventSupported');
23
-
24
- /**
25
- * Summary of `ReactBrowserEventEmitter` event handling:
26
- *
27
- * - Top-level delegation is used to trap most native browser events. This
28
- * may only occur in the main thread and is the responsibility of
29
- * ReactEventListener, which is injected and can therefore support pluggable
30
- * event sources. This is the only work that occurs in the main thread.
31
- *
32
- * - We normalize and de-duplicate events to account for browser quirks. This
33
- * may be done in the worker thread.
34
- *
35
- * - Forward these native events (with the associated top-level type used to
36
- * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
37
- * to extract any synthetic events.
38
- *
39
- * - The `EventPluginHub` will then process each event by annotating them with
40
- * "dispatches", a sequence of listeners and IDs that care about that event.
41
- *
42
- * - The `EventPluginHub` then dispatches the events.
43
- *
44
- * Overview of React and the event system:
45
- *
46
- * +------------+ .
47
- * | DOM | .
48
- * +------------+ .
49
- * | .
50
- * v .
51
- * +------------+ .
52
- * | ReactEvent | .
53
- * | Listener | .
54
- * +------------+ . +-----------+
55
- * | . +--------+|SimpleEvent|
56
- * | . | |Plugin |
57
- * +-----|------+ . v +-----------+
58
- * | | | . +--------------+ +------------+
59
- * | +-----------.--->|EventPluginHub| | Event |
60
- * | | . | | +-----------+ | Propagators|
61
- * | ReactEvent | . | | |TapEvent | |------------|
62
- * | Emitter | . | |<---+|Plugin | |other plugin|
63
- * | | . | | +-----------+ | utilities |
64
- * | +-----------.--->| | +------------+
65
- * | | | . +--------------+
66
- * +-----|------+ . ^ +-----------+
67
- * | . | |Enter/Leave|
68
- * + . +-------+|Plugin |
69
- * +-------------+ . +-----------+
70
- * | application | .
71
- * |-------------| .
72
- * | | .
73
- * | | .
74
- * +-------------+ .
75
- * .
76
- * React Core . General Purpose Event Plugin System
77
- */
78
-
79
- var hasEventPageXY;
80
- var alreadyListeningTo = {};
81
- var isMonitoringScrollValue = false;
82
- var reactTopListenersCounter = 0;
83
-
84
- // For events like 'submit' which don't consistently bubble (which we trap at a
85
- // lower node than `document`), binding at `document` would cause duplicate
86
- // events so we don't include them here
87
- var topEventMapping = {
88
- topAbort: 'abort',
89
- topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
90
- topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
91
- topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
92
- topBlur: 'blur',
93
- topCanPlay: 'canplay',
94
- topCanPlayThrough: 'canplaythrough',
95
- topChange: 'change',
96
- topClick: 'click',
97
- topCompositionEnd: 'compositionend',
98
- topCompositionStart: 'compositionstart',
99
- topCompositionUpdate: 'compositionupdate',
100
- topContextMenu: 'contextmenu',
101
- topCopy: 'copy',
102
- topCut: 'cut',
103
- topDoubleClick: 'dblclick',
104
- topDrag: 'drag',
105
- topDragEnd: 'dragend',
106
- topDragEnter: 'dragenter',
107
- topDragExit: 'dragexit',
108
- topDragLeave: 'dragleave',
109
- topDragOver: 'dragover',
110
- topDragStart: 'dragstart',
111
- topDrop: 'drop',
112
- topDurationChange: 'durationchange',
113
- topEmptied: 'emptied',
114
- topEncrypted: 'encrypted',
115
- topEnded: 'ended',
116
- topError: 'error',
117
- topFocus: 'focus',
118
- topInput: 'input',
119
- topKeyDown: 'keydown',
120
- topKeyPress: 'keypress',
121
- topKeyUp: 'keyup',
122
- topLoadedData: 'loadeddata',
123
- topLoadedMetadata: 'loadedmetadata',
124
- topLoadStart: 'loadstart',
125
- topMouseDown: 'mousedown',
126
- topMouseMove: 'mousemove',
127
- topMouseOut: 'mouseout',
128
- topMouseOver: 'mouseover',
129
- topMouseUp: 'mouseup',
130
- topPaste: 'paste',
131
- topPause: 'pause',
132
- topPlay: 'play',
133
- topPlaying: 'playing',
134
- topProgress: 'progress',
135
- topRateChange: 'ratechange',
136
- topScroll: 'scroll',
137
- topSeeked: 'seeked',
138
- topSeeking: 'seeking',
139
- topSelectionChange: 'selectionchange',
140
- topStalled: 'stalled',
141
- topSuspend: 'suspend',
142
- topTextInput: 'textInput',
143
- topTimeUpdate: 'timeupdate',
144
- topTouchCancel: 'touchcancel',
145
- topTouchEnd: 'touchend',
146
- topTouchMove: 'touchmove',
147
- topTouchStart: 'touchstart',
148
- topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
149
- topVolumeChange: 'volumechange',
150
- topWaiting: 'waiting',
151
- topWheel: 'wheel'
152
- };
153
-
154
- /**
155
- * To ensure no conflicts with other potential React instances on the page
156
- */
157
- var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
158
-
159
- function getListeningForDocument(mountAt) {
160
- // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
161
- // directly.
162
- if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
163
- mountAt[topListenersIDKey] = reactTopListenersCounter++;
164
- alreadyListeningTo[mountAt[topListenersIDKey]] = {};
165
- }
166
- return alreadyListeningTo[mountAt[topListenersIDKey]];
167
- }
168
-
169
- /**
170
- * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
171
- * example:
172
- *
173
- * EventPluginHub.putListener('myID', 'onClick', myFunction);
174
- *
175
- * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
176
- *
177
- * @internal
178
- */
179
- var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
180
-
181
- /**
182
- * Injectable event backend
183
- */
184
- ReactEventListener: null,
185
-
186
- injection: {
187
- /**
188
- * @param {object} ReactEventListener
189
- */
190
- injectReactEventListener: function (ReactEventListener) {
191
- ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
192
- ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
193
- }
194
- },
195
-
196
- /**
197
- * Sets whether or not any created callbacks should be enabled.
198
- *
199
- * @param {boolean} enabled True if callbacks should be enabled.
200
- */
201
- setEnabled: function (enabled) {
202
- if (ReactBrowserEventEmitter.ReactEventListener) {
203
- ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
204
- }
205
- },
206
-
207
- /**
208
- * @return {boolean} True if callbacks are enabled.
209
- */
210
- isEnabled: function () {
211
- return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
212
- },
213
-
214
- /**
215
- * We listen for bubbled touch events on the document object.
216
- *
217
- * Firefox v8.01 (and possibly others) exhibited strange behavior when
218
- * mounting `onmousemove` events at some node that was not the document
219
- * element. The symptoms were that if your mouse is not moving over something
220
- * contained within that mount point (for example on the background) the
221
- * top-level listeners for `onmousemove` won't be called. However, if you
222
- * register the `mousemove` on the document object, then it will of course
223
- * catch all `mousemove`s. This along with iOS quirks, justifies restricting
224
- * top-level listeners to the document object only, at least for these
225
- * movement types of events and possibly all events.
226
- *
227
- * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
228
- *
229
- * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
230
- * they bubble to document.
231
- *
232
- * @param {string} registrationName Name of listener (e.g. `onClick`).
233
- * @param {object} contentDocumentHandle Document which owns the container
234
- */
235
- listenTo: function (registrationName, contentDocumentHandle) {
236
- var mountAt = contentDocumentHandle;
237
- var isListening = getListeningForDocument(mountAt);
238
- var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
239
-
240
- var topLevelTypes = EventConstants.topLevelTypes;
241
- for (var i = 0; i < dependencies.length; i++) {
242
- var dependency = dependencies[i];
243
- if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
244
- if (dependency === topLevelTypes.topWheel) {
245
- if (isEventSupported('wheel')) {
246
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
247
- } else if (isEventSupported('mousewheel')) {
248
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
249
- } else {
250
- // Firefox needs to capture a different mouse scroll event.
251
- // @see http://www.quirksmode.org/dom/events/tests/scroll.html
252
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
253
- }
254
- } else if (dependency === topLevelTypes.topScroll) {
255
-
256
- if (isEventSupported('scroll', true)) {
257
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
258
- } else {
259
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
260
- }
261
- } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
262
-
263
- if (isEventSupported('focus', true)) {
264
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
265
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
266
- } else if (isEventSupported('focusin')) {
267
- // IE has `focusin` and `focusout` events which bubble.
268
- // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
269
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
270
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
271
- }
272
-
273
- // to make sure blur and focus event listeners are only attached once
274
- isListening[topLevelTypes.topBlur] = true;
275
- isListening[topLevelTypes.topFocus] = true;
276
- } else if (topEventMapping.hasOwnProperty(dependency)) {
277
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
278
- }
279
-
280
- isListening[dependency] = true;
281
- }
282
- }
283
- },
284
-
285
- trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
286
- return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
287
- },
288
-
289
- trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
290
- return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
291
- },
292
-
293
- /**
294
- * Protect against document.createEvent() returning null
295
- * Some popup blocker extensions appear to do this:
296
- * https://github.com/facebook/react/issues/6887
297
- */
298
- supportsEventPageXY: function () {
299
- if (!document.createEvent) {
300
- return false;
301
- }
302
- var ev = document.createEvent('MouseEvent');
303
- return ev != null && 'pageX' in ev;
304
- },
305
-
306
- /**
307
- * Listens to window scroll and resize events. We cache scroll values so that
308
- * application code can access them without triggering reflows.
309
- *
310
- * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
311
- * pageX/pageY isn't supported (legacy browsers).
312
- *
313
- * NOTE: Scroll events do not bubble.
314
- *
315
- * @see http://www.quirksmode.org/dom/events/scroll.html
316
- */
317
- ensureScrollValueMonitoring: function () {
318
- if (hasEventPageXY === undefined) {
319
- hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
320
- }
321
- if (!hasEventPageXY && !isMonitoringScrollValue) {
322
- var refresh = ViewportMetrics.refreshScrollValues;
323
- ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
324
- isMonitoringScrollValue = true;
325
- }
326
- }
327
-
328
- });
329
-
330
- module.exports = ReactBrowserEventEmitter;