react 0.14.0-alpha3 → 0.14.0-rc1

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 (200) hide show
  1. package/README.md +5 -2
  2. package/addons.js +8 -3
  3. package/dist/react-dom.js +42 -0
  4. package/dist/react-dom.min.js +12 -0
  5. package/dist/react-with-addons.js +6076 -5337
  6. package/dist/react-with-addons.min.js +6 -6
  7. package/dist/react.js +5445 -4839
  8. package/dist/react.min.js +6 -5
  9. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
  10. package/lib/BeforeInputEventPlugin.js +13 -13
  11. package/lib/CSSProperty.js +18 -3
  12. package/lib/CSSPropertyOperations.js +22 -14
  13. package/lib/CallbackQueue.js +4 -4
  14. package/lib/ChangeEventPlugin.js +18 -15
  15. package/lib/DOMChildrenOperations.js +17 -7
  16. package/lib/DOMProperty.js +82 -117
  17. package/lib/DOMPropertyOperations.js +84 -33
  18. package/lib/Danger.js +21 -16
  19. package/lib/DefaultEventPluginOrder.js +2 -2
  20. package/lib/EnterLeaveEventPlugin.js +21 -13
  21. package/lib/EventConstants.js +23 -1
  22. package/lib/EventPluginHub.js +17 -20
  23. package/lib/EventPluginRegistry.js +8 -8
  24. package/lib/EventPluginUtils.js +33 -42
  25. package/lib/EventPropagators.js +8 -8
  26. package/lib/FallbackCompositionState.js +9 -3
  27. package/lib/HTMLDOMPropertyConfig.js +19 -3
  28. package/lib/LinkedStateMixin.js +2 -2
  29. package/lib/LinkedValueUtils.js +50 -38
  30. package/lib/MetaMatchers.js +118 -0
  31. package/lib/OrderedMap.js +453 -0
  32. package/lib/PooledClass.js +15 -5
  33. package/lib/React.js +18 -7
  34. package/lib/ReactBrowserComponentMixin.js +4 -4
  35. package/lib/ReactBrowserEventEmitter.js +30 -7
  36. package/lib/ReactCSSTransitionGroup.js +35 -9
  37. package/lib/ReactCSSTransitionGroupChild.js +56 -30
  38. package/lib/ReactChildReconciler.js +24 -19
  39. package/lib/ReactChildren.js +75 -35
  40. package/lib/ReactClass.js +70 -87
  41. package/lib/ReactComponent.js +27 -20
  42. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  43. package/lib/ReactComponentEnvironment.js +2 -2
  44. package/lib/ReactComponentWithPureRenderMixin.js +3 -3
  45. package/lib/ReactCompositeComponent.js +117 -106
  46. package/lib/ReactDOM.js +74 -158
  47. package/lib/ReactDOMButton.js +15 -26
  48. package/lib/ReactDOMComponent.js +441 -72
  49. package/lib/ReactDOMFactories.js +177 -0
  50. package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
  51. package/lib/ReactDOMIDOperations.js +8 -66
  52. package/lib/ReactDOMInput.js +87 -99
  53. package/lib/ReactDOMOption.js +25 -44
  54. package/lib/ReactDOMSelect.js +88 -98
  55. package/lib/ReactDOMSelection.js +3 -3
  56. package/lib/ReactDOMServer.js +5 -3
  57. package/lib/ReactDOMTextComponent.js +33 -20
  58. package/lib/ReactDOMTextarea.js +48 -61
  59. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  60. package/lib/ReactDefaultInjection.js +23 -72
  61. package/lib/ReactDefaultPerf.js +7 -7
  62. package/lib/ReactDefaultPerfAnalysis.js +6 -11
  63. package/lib/ReactElement.js +92 -107
  64. package/lib/ReactElementValidator.js +53 -173
  65. package/lib/ReactEmptyComponent.js +26 -62
  66. package/lib/ReactEmptyComponentRegistry.js +48 -0
  67. package/lib/ReactErrorUtils.js +45 -9
  68. package/lib/ReactEventEmitterMixin.js +3 -4
  69. package/lib/ReactEventListener.js +64 -12
  70. package/lib/ReactFragment.js +29 -115
  71. package/lib/ReactInjection.js +10 -12
  72. package/lib/ReactInputSelection.js +8 -7
  73. package/lib/ReactInstanceHandles.js +12 -12
  74. package/lib/ReactIsomorphic.js +15 -11
  75. package/lib/ReactLink.js +1 -1
  76. package/lib/ReactMarkupChecksum.js +6 -2
  77. package/lib/ReactMount.js +196 -122
  78. package/lib/ReactMultiChild.js +119 -25
  79. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  80. package/lib/ReactNativeComponent.js +3 -8
  81. package/lib/ReactNoopUpdateQueue.js +118 -0
  82. package/lib/ReactOwner.js +3 -3
  83. package/lib/ReactPerf.js +2 -2
  84. package/lib/ReactPropTransferer.js +3 -3
  85. package/lib/ReactPropTypeLocationNames.js +1 -1
  86. package/lib/ReactPropTypeLocations.js +1 -1
  87. package/lib/ReactPropTypes.js +41 -12
  88. package/lib/ReactReconcileTransaction.js +12 -10
  89. package/lib/ReactReconciler.js +8 -11
  90. package/lib/ReactRef.js +15 -2
  91. package/lib/ReactServerBatchingStrategy.js +23 -0
  92. package/lib/ReactServerRendering.js +22 -9
  93. package/lib/ReactServerRenderingTransaction.js +8 -7
  94. package/lib/ReactTestUtils.js +89 -64
  95. package/lib/ReactTransitionChildMapping.js +3 -6
  96. package/lib/ReactTransitionEvents.js +1 -1
  97. package/lib/ReactTransitionGroup.js +5 -6
  98. package/lib/ReactUpdateQueue.js +60 -35
  99. package/lib/ReactUpdates.js +15 -18
  100. package/lib/{isTextNode.js → ReactVersion.js} +2 -13
  101. package/lib/ReactWithAddons.js +24 -17
  102. package/lib/ResponderEventPlugin.js +514 -0
  103. package/lib/ResponderSyntheticEvent.js +40 -0
  104. package/lib/ResponderTouchHistoryStore.js +180 -0
  105. package/lib/SVGDOMPropertyConfig.js +1 -1
  106. package/lib/SelectEventPlugin.js +25 -16
  107. package/lib/SimpleEventPlugin.js +200 -45
  108. package/lib/SyntheticClipboardEvent.js +3 -3
  109. package/lib/SyntheticCompositionEvent.js +3 -3
  110. package/lib/SyntheticDragEvent.js +3 -3
  111. package/lib/SyntheticEvent.js +24 -8
  112. package/lib/SyntheticFocusEvent.js +3 -3
  113. package/lib/SyntheticInputEvent.js +3 -3
  114. package/lib/SyntheticKeyboardEvent.js +6 -6
  115. package/lib/SyntheticMouseEvent.js +5 -5
  116. package/lib/SyntheticTouchEvent.js +4 -4
  117. package/lib/SyntheticUIEvent.js +4 -4
  118. package/lib/SyntheticWheelEvent.js +3 -3
  119. package/lib/TapEventPlugin.js +119 -0
  120. package/lib/Transaction.js +17 -11
  121. package/lib/accumulate.js +44 -0
  122. package/lib/accumulateInto.js +2 -2
  123. package/lib/adler32.js +19 -7
  124. package/lib/cloneWithProps.js +12 -7
  125. package/lib/createHierarchyRenderer.js +85 -0
  126. package/lib/dangerousStyleValue.js +1 -1
  127. package/lib/deprecated.js +48 -0
  128. package/lib/findDOMNode.js +11 -12
  129. package/lib/flattenChildren.js +4 -4
  130. package/lib/forEachAccumulated.js +1 -1
  131. package/lib/getEventCharCode.js +1 -1
  132. package/lib/getEventKey.js +1 -1
  133. package/lib/getEventModifierState.js +0 -1
  134. package/lib/getTestDocument.js +28 -0
  135. package/lib/getTextContentAccessor.js +1 -1
  136. package/lib/instantiateReactComponent.js +27 -25
  137. package/lib/isEventSupported.js +1 -1
  138. package/lib/isTextInputElement.js +2 -1
  139. package/lib/joinClasses.js +1 -1
  140. package/lib/onlyChild.js +3 -3
  141. package/lib/quoteAttributeValueForBrowser.js +1 -1
  142. package/lib/reactComponentExpect.js +216 -0
  143. package/lib/renderSubtreeIntoContainer.js +1 -1
  144. package/lib/setInnerHTML.js +2 -2
  145. package/lib/setTextContent.js +3 -3
  146. package/lib/shallowCompare.js +1 -1
  147. package/lib/shouldUpdateReactComponent.js +12 -8
  148. package/lib/sliceChildren.js +34 -0
  149. package/lib/traverseAllChildren.js +21 -19
  150. package/lib/update.js +13 -13
  151. package/lib/validateDOMNesting.js +6 -6
  152. package/lib/webcomponents.js +6379 -0
  153. package/package.json +4 -6
  154. package/react.js +2 -0
  155. package/addons/CSSTransitionGroup.js +0 -1
  156. package/addons/LinkedStateMixin.js +0 -1
  157. package/addons/Perf.js +0 -1
  158. package/addons/PureRenderMixin.js +0 -1
  159. package/addons/TestUtils.js +0 -1
  160. package/addons/TransitionGroup.js +0 -1
  161. package/addons/batchedUpdates.js +0 -1
  162. package/addons/cloneWithProps.js +0 -1
  163. package/addons/createFragment.js +0 -1
  164. package/addons/renderSubtreeIntoContainer.js +0 -1
  165. package/addons/shallowCompare.js +0 -1
  166. package/addons/update.js +0 -1
  167. package/dist/JSXTransformer.js +0 -17589
  168. package/lib/CSSCore.js +0 -97
  169. package/lib/EventListener.js +0 -84
  170. package/lib/ExecutionEnvironment.js +0 -38
  171. package/lib/LocalEventTrapMixin.js +0 -46
  172. package/lib/ReactContext.js +0 -32
  173. package/lib/ReactDOMClient.js +0 -85
  174. package/lib/ReactDOMForm.js +0 -47
  175. package/lib/ReactDOMIframe.js +0 -43
  176. package/lib/ReactDOMImg.js +0 -44
  177. package/lib/ReactLifeCycle.js +0 -35
  178. package/lib/camelize.js +0 -32
  179. package/lib/camelizeStyleName.js +0 -40
  180. package/lib/containsNode.js +0 -55
  181. package/lib/createArrayFromMixed.js +0 -85
  182. package/lib/createFullPageComponent.js +0 -51
  183. package/lib/createNodesFromMarkup.js +0 -84
  184. package/lib/emptyFunction.js +0 -38
  185. package/lib/focusNode.js +0 -26
  186. package/lib/getActiveElement.js +0 -29
  187. package/lib/getMarkupWrap.js +0 -115
  188. package/lib/getUnboundedScrollPosition.js +0 -38
  189. package/lib/hyphenate.js +0 -33
  190. package/lib/hyphenateStyleName.js +0 -39
  191. package/lib/invariant.js +0 -49
  192. package/lib/isNode.js +0 -23
  193. package/lib/keyMirror.js +0 -48
  194. package/lib/keyOf.js +0 -35
  195. package/lib/mapObject.js +0 -51
  196. package/lib/performance.js +0 -23
  197. package/lib/performanceNow.js +0 -28
  198. package/lib/shallowEqual.js +0 -48
  199. package/lib/toArray.js +0 -57
  200. package/lib/warning.js +0 -61
@@ -12,7 +12,7 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var invariant = require("./invariant");
15
+ var invariant = require('fbjs/lib/invariant');
16
16
 
17
17
  /**
18
18
  * Injectable ordering of event plugins.
@@ -37,15 +37,15 @@ function recomputePluginOrdering() {
37
37
  for (var pluginName in namesToPlugins) {
38
38
  var PluginModule = namesToPlugins[pluginName];
39
39
  var pluginIndex = EventPluginOrder.indexOf(pluginName);
40
- !(pluginIndex > -1) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
40
+ !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
41
41
  if (EventPluginRegistry.plugins[pluginIndex]) {
42
42
  continue;
43
43
  }
44
- !PluginModule.extractEvents ? 'production' !== process.env.NODE_ENV ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
44
+ !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
45
45
  EventPluginRegistry.plugins[pluginIndex] = PluginModule;
46
46
  var publishedEvents = PluginModule.eventTypes;
47
47
  for (var eventName in publishedEvents) {
48
- !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
48
+ !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
49
49
  }
50
50
  }
51
51
  }
@@ -59,7 +59,7 @@ function recomputePluginOrdering() {
59
59
  * @private
60
60
  */
61
61
  function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
62
- !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
62
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
63
63
  EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
64
64
 
65
65
  var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
@@ -87,7 +87,7 @@ function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
87
87
  * @private
88
88
  */
89
89
  function publishRegistrationName(registrationName, PluginModule, eventName) {
90
- !!EventPluginRegistry.registrationNameModules[registrationName] ? 'production' !== process.env.NODE_ENV ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
90
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
91
91
  EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
92
92
  EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
93
93
  }
@@ -129,7 +129,7 @@ var EventPluginRegistry = {
129
129
  * @see {EventPluginHub.injection.injectEventPluginOrder}
130
130
  */
131
131
  injectEventPluginOrder: function (InjectedEventPluginOrder) {
132
- !!EventPluginOrder ? 'production' !== process.env.NODE_ENV ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
132
+ !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
133
133
  // Clone the ordering so it cannot be dynamically mutated.
134
134
  EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
135
135
  recomputePluginOrdering();
@@ -153,7 +153,7 @@ var EventPluginRegistry = {
153
153
  }
154
154
  var PluginModule = injectedNamesToPlugins[pluginName];
155
155
  if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
156
- !!namesToPlugins[pluginName] ? 'production' !== process.env.NODE_ENV ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
156
+ !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
157
157
  namesToPlugins[pluginName] = PluginModule;
158
158
  isOrderingDirty = true;
159
159
  }
@@ -11,10 +11,11 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var EventConstants = require("./EventConstants");
14
+ var EventConstants = require('./EventConstants');
15
+ var ReactErrorUtils = require('./ReactErrorUtils');
15
16
 
16
- var invariant = require("./invariant");
17
- var warning = require("./warning");
17
+ var invariant = require('fbjs/lib/invariant');
18
+ var warning = require('fbjs/lib/warning');
18
19
 
19
20
  /**
20
21
  * Injected dependencies:
@@ -28,8 +29,8 @@ var injection = {
28
29
  Mount: null,
29
30
  injectMount: function (InjectedMount) {
30
31
  injection.Mount = InjectedMount;
31
- if ('production' !== process.env.NODE_ENV) {
32
- 'production' !== process.env.NODE_ENV ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
32
+ if (process.env.NODE_ENV !== 'production') {
33
+ process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
33
34
  }
34
35
  }
35
36
  };
@@ -48,7 +49,7 @@ function isStartish(topLevelType) {
48
49
  }
49
50
 
50
51
  var validateEventDispatches;
51
- if ('production' !== process.env.NODE_ENV) {
52
+ if (process.env.NODE_ENV !== 'production') {
52
53
  validateEventDispatches = function (event) {
53
54
  var dispatchListeners = event._dispatchListeners;
54
55
  var dispatchIDs = event._dispatchIDs;
@@ -58,19 +59,30 @@ if ('production' !== process.env.NODE_ENV) {
58
59
  var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
59
60
  var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
60
61
 
61
- 'production' !== process.env.NODE_ENV ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
62
+ process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
62
63
  };
63
64
  }
64
65
 
65
66
  /**
66
- * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
67
- * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
68
- * kept separate to conserve memory.
67
+ * Dispatch the event to the listener.
68
+ * @param {SyntheticEvent} event SyntheticEvent to handle
69
+ * @param {function} listener Application-level callback
70
+ * @param {string} domID DOM id to pass to the callback.
69
71
  */
70
- function forEachEventDispatch(event, cb) {
72
+ function executeDispatch(event, listener, domID) {
73
+ var type = event.type || 'unknown-event';
74
+ event.currentTarget = injection.Mount.getNode(domID);
75
+ ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
76
+ event.currentTarget = null;
77
+ }
78
+
79
+ /**
80
+ * Standard/simple iteration through an event's collected dispatches.
81
+ */
82
+ function executeDispatchesInOrder(event) {
71
83
  var dispatchListeners = event._dispatchListeners;
72
84
  var dispatchIDs = event._dispatchIDs;
73
- if ('production' !== process.env.NODE_ENV) {
85
+ if (process.env.NODE_ENV !== 'production') {
74
86
  validateEventDispatches(event);
75
87
  }
76
88
  if (Array.isArray(dispatchListeners)) {
@@ -79,31 +91,11 @@ function forEachEventDispatch(event, cb) {
79
91
  break;
80
92
  }
81
93
  // Listeners and IDs are two parallel arrays that are always in sync.
82
- cb(event, dispatchListeners[i], dispatchIDs[i]);
94
+ executeDispatch(event, dispatchListeners[i], dispatchIDs[i]);
83
95
  }
84
96
  } else if (dispatchListeners) {
85
- cb(event, dispatchListeners, dispatchIDs);
97
+ executeDispatch(event, dispatchListeners, dispatchIDs);
86
98
  }
87
- }
88
-
89
- /**
90
- * Default implementation of PluginModule.executeDispatch().
91
- * @param {SyntheticEvent} SyntheticEvent to handle
92
- * @param {function} Application-level callback
93
- * @param {string} domID DOM id to pass to the callback.
94
- */
95
- function executeDispatch(event, listener, domID) {
96
- event.currentTarget = injection.Mount.getNode(domID);
97
- var returnValue = listener(event, domID);
98
- event.currentTarget = null;
99
- return returnValue;
100
- }
101
-
102
- /**
103
- * Standard/simple iteration through an event's collected dispatches.
104
- */
105
- function executeDispatchesInOrder(event, cb) {
106
- forEachEventDispatch(event, cb);
107
99
  event._dispatchListeners = null;
108
100
  event._dispatchIDs = null;
109
101
  }
@@ -112,13 +104,13 @@ function executeDispatchesInOrder(event, cb) {
112
104
  * Standard/simple iteration through an event's collected dispatches, but stops
113
105
  * at the first dispatch execution returning true, and returns that id.
114
106
  *
115
- * @return id of the first dispatch execution who's listener returns true, or
116
- * null if no listener returned true.
107
+ * @return {?string} id of the first dispatch execution who's listener returns
108
+ * true, or null if no listener returned true.
117
109
  */
118
110
  function executeDispatchesInOrderStopAtTrueImpl(event) {
119
111
  var dispatchListeners = event._dispatchListeners;
120
112
  var dispatchIDs = event._dispatchIDs;
121
- if ('production' !== process.env.NODE_ENV) {
113
+ if (process.env.NODE_ENV !== 'production') {
122
114
  validateEventDispatches(event);
123
115
  }
124
116
  if (Array.isArray(dispatchListeners)) {
@@ -156,15 +148,15 @@ function executeDispatchesInOrderStopAtTrue(event) {
156
148
  * return values at each dispatch execution, but it does tend to make sense when
157
149
  * dealing with "direct" dispatches.
158
150
  *
159
- * @return The return value of executing the single dispatch.
151
+ * @return {*} The return value of executing the single dispatch.
160
152
  */
161
153
  function executeDirectDispatch(event) {
162
- if ('production' !== process.env.NODE_ENV) {
154
+ if (process.env.NODE_ENV !== 'production') {
163
155
  validateEventDispatches(event);
164
156
  }
165
157
  var dispatchListener = event._dispatchListeners;
166
158
  var dispatchID = event._dispatchIDs;
167
- !!Array.isArray(dispatchListener) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
159
+ !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
168
160
  var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
169
161
  event._dispatchListeners = null;
170
162
  event._dispatchIDs = null;
@@ -173,7 +165,7 @@ function executeDirectDispatch(event) {
173
165
 
174
166
  /**
175
167
  * @param {SyntheticEvent} event
176
- * @return {bool} True iff number of dispatches accumulated is greater than 0.
168
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
177
169
  */
178
170
  function hasDispatches(event) {
179
171
  return !!event._dispatchListeners;
@@ -188,7 +180,6 @@ var EventPluginUtils = {
188
180
  isStartish: isStartish,
189
181
 
190
182
  executeDirectDispatch: executeDirectDispatch,
191
- executeDispatch: executeDispatch,
192
183
  executeDispatchesInOrder: executeDispatchesInOrder,
193
184
  executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
194
185
  hasDispatches: hasDispatches,
@@ -11,13 +11,13 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var EventConstants = require("./EventConstants");
15
- var EventPluginHub = require("./EventPluginHub");
14
+ var EventConstants = require('./EventConstants');
15
+ var EventPluginHub = require('./EventPluginHub');
16
16
 
17
- var warning = require("./warning");
17
+ var warning = require('fbjs/lib/warning');
18
18
 
19
- var accumulateInto = require("./accumulateInto");
20
- var forEachAccumulated = require("./forEachAccumulated");
19
+ var accumulateInto = require('./accumulateInto');
20
+ var forEachAccumulated = require('./forEachAccumulated');
21
21
 
22
22
  var PropagationPhases = EventConstants.PropagationPhases;
23
23
  var getListener = EventPluginHub.getListener;
@@ -38,8 +38,8 @@ function listenerAtPhase(id, event, propagationPhase) {
38
38
  * "dispatch" object that pairs the event with the listener.
39
39
  */
40
40
  function accumulateDirectionalDispatches(domID, upwards, event) {
41
- if ('production' !== process.env.NODE_ENV) {
42
- 'production' !== process.env.NODE_ENV ? warning(domID, 'Dispatching id must not be null') : undefined;
41
+ if (process.env.NODE_ENV !== 'production') {
42
+ process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
43
43
  }
44
44
  var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
45
45
  var listener = listenerAtPhase(domID, event, phase);
@@ -52,7 +52,7 @@ function accumulateDirectionalDispatches(domID, upwards, event) {
52
52
  /**
53
53
  * Collect dispatches (must be entirely collected before dispatching - see unit
54
54
  * tests). Lazily allocate the array to conserve memory. We must loop through
55
- * each event and perform the traversal for each one. We can not perform a
55
+ * each event and perform the traversal for each one. We cannot perform a
56
56
  * single traversal for the entire collection of events because each event may
57
57
  * have a different target.
58
58
  */
@@ -12,10 +12,10 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var PooledClass = require("./PooledClass");
15
+ var PooledClass = require('./PooledClass');
16
16
 
17
- var assign = require("./Object.assign");
18
- var getTextContentAccessor = require("./getTextContentAccessor");
17
+ var assign = require('./Object.assign');
18
+ var getTextContentAccessor = require('./getTextContentAccessor');
19
19
 
20
20
  /**
21
21
  * This helper class stores information about text content of a target node,
@@ -35,6 +35,12 @@ function FallbackCompositionState(root) {
35
35
  }
36
36
 
37
37
  assign(FallbackCompositionState.prototype, {
38
+ destructor: function () {
39
+ this._root = null;
40
+ this._startText = null;
41
+ this._fallbackText = null;
42
+ },
43
+
38
44
  /**
39
45
  * Get current text of input.
40
46
  *
@@ -11,8 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var DOMProperty = require("./DOMProperty");
15
- var ExecutionEnvironment = require("./ExecutionEnvironment");
14
+ var DOMProperty = require('./DOMProperty');
15
+ var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
16
16
 
17
17
  var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
18
18
  var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
@@ -43,13 +43,14 @@ var HTMLDOMPropertyConfig = {
43
43
  alt: null,
44
44
  async: HAS_BOOLEAN_VALUE,
45
45
  autoComplete: null,
46
- // autoFocus is polyfilled/normalized by AutoFocusMixin
46
+ // autoFocus is polyfilled/normalized by AutoFocusUtils
47
47
  // autoFocus: HAS_BOOLEAN_VALUE,
48
48
  autoPlay: HAS_BOOLEAN_VALUE,
49
49
  capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
50
50
  cellPadding: null,
51
51
  cellSpacing: null,
52
52
  charSet: MUST_USE_ATTRIBUTE,
53
+ challenge: MUST_USE_ATTRIBUTE,
53
54
  checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
54
55
  classID: MUST_USE_ATTRIBUTE,
55
56
  // To set className on SVG elements, it's necessary to use .setAttribute;
@@ -91,6 +92,10 @@ var HTMLDOMPropertyConfig = {
91
92
  httpEquiv: null,
92
93
  icon: null,
93
94
  id: MUST_USE_PROPERTY,
95
+ inputMode: MUST_USE_ATTRIBUTE,
96
+ is: MUST_USE_ATTRIBUTE,
97
+ keyParams: MUST_USE_ATTRIBUTE,
98
+ keyType: MUST_USE_ATTRIBUTE,
94
99
  label: null,
95
100
  lang: null,
96
101
  list: MUST_USE_ATTRIBUTE,
@@ -140,6 +145,7 @@ var HTMLDOMPropertyConfig = {
140
145
  start: HAS_NUMERIC_VALUE,
141
146
  step: null,
142
147
  style: null,
148
+ summary: null,
143
149
  tabIndex: null,
144
150
  target: null,
145
151
  title: null,
@@ -148,6 +154,7 @@ var HTMLDOMPropertyConfig = {
148
154
  value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
149
155
  width: MUST_USE_ATTRIBUTE,
150
156
  wmode: MUST_USE_ATTRIBUTE,
157
+ wrap: null,
151
158
 
152
159
  /**
153
160
  * Non-standard Properties
@@ -156,6 +163,8 @@ var HTMLDOMPropertyConfig = {
156
163
  // keyboard hints.
157
164
  autoCapitalize: null,
158
165
  autoCorrect: null,
166
+ // autoSave allows WebKit/Blink to persist values of input fields on page reloads
167
+ autoSave: null,
159
168
  // itemProp, itemScope, itemType are for
160
169
  // Microdata support. See http://schema.org/docs/gs.html
161
170
  itemProp: MUST_USE_ATTRIBUTE,
@@ -168,6 +177,12 @@ var HTMLDOMPropertyConfig = {
168
177
  itemRef: MUST_USE_ATTRIBUTE,
169
178
  // property is supported for OpenGraph in meta tags.
170
179
  property: null,
180
+ // results show looking glass icon and recent searches on input
181
+ // search fields in WebKit/Blink
182
+ results: null,
183
+ // IE-only attribute that specifies security restrictions on an iframe
184
+ // as an alternative to the sandbox attribute on IE<10
185
+ security: MUST_USE_ATTRIBUTE,
171
186
  // IE-only attribute that controls focus behavior
172
187
  unselectable: MUST_USE_ATTRIBUTE
173
188
  },
@@ -183,6 +198,7 @@ var HTMLDOMPropertyConfig = {
183
198
  autoCorrect: 'autocorrect',
184
199
  autoFocus: 'autofocus',
185
200
  autoPlay: 'autoplay',
201
+ autoSave: 'autosave',
186
202
  // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
187
203
  // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
188
204
  encType: 'encoding',
@@ -12,8 +12,8 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var ReactLink = require("./ReactLink");
16
- var ReactStateSetters = require("./ReactStateSetters");
15
+ var ReactLink = require('./ReactLink');
16
+ var ReactStateSetters = require('./ReactStateSetters');
17
17
 
18
18
  /**
19
19
  * A simple mixin around ReactLink.forState().
@@ -12,9 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var ReactPropTypes = require("./ReactPropTypes");
15
+ var ReactPropTypes = require('./ReactPropTypes');
16
+ var ReactPropTypeLocations = require('./ReactPropTypeLocations');
16
17
 
17
- var invariant = require("./invariant");
18
+ var invariant = require('fbjs/lib/invariant');
19
+ var warning = require('fbjs/lib/warning');
18
20
 
19
21
  var hasReadOnlyValue = {
20
22
  'button': true,
@@ -27,32 +29,43 @@ var hasReadOnlyValue = {
27
29
  };
28
30
 
29
31
  function _assertSingleLink(inputProps) {
30
- !(inputProps.checkedLink == null || inputProps.valueLink == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
32
+ !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
31
33
  }
32
34
  function _assertValueLink(inputProps) {
33
35
  _assertSingleLink(inputProps);
34
- !(inputProps.value == null && inputProps.onChange == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
36
+ !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
35
37
  }
36
38
 
37
39
  function _assertCheckedLink(inputProps) {
38
40
  _assertSingleLink(inputProps);
39
- !(inputProps.checked == null && inputProps.onChange == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
41
+ !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
40
42
  }
41
43
 
42
- /**
43
- * @param {SyntheticEvent} e change event to handle
44
- */
45
- function _handleLinkedValueChange(e) {
46
- /*jshint validthis:true */
47
- this.props.valueLink.requestChange(e.target.value);
48
- }
44
+ var propTypes = {
45
+ value: function (props, propName, componentName) {
46
+ if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
47
+ return null;
48
+ }
49
+ return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
50
+ },
51
+ checked: function (props, propName, componentName) {
52
+ if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
53
+ return null;
54
+ }
55
+ return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
56
+ },
57
+ onChange: ReactPropTypes.func
58
+ };
49
59
 
50
- /**
51
- * @param {SyntheticEvent} e change event to handle
52
- */
53
- function _handleLinkedCheckChange(e) {
54
- /*jshint validthis:true */
55
- this.props.checkedLink.requestChange(e.target.checked);
60
+ var loggedTypeFailures = {};
61
+ function getDeclarationErrorAddendum(owner) {
62
+ if (owner) {
63
+ var name = owner.getName();
64
+ if (name) {
65
+ return ' Check the render method of `' + name + '`.';
66
+ }
67
+ }
68
+ return '';
56
69
  }
57
70
 
58
71
  /**
@@ -60,21 +73,19 @@ function _handleLinkedCheckChange(e) {
60
73
  * this outside of the ReactDOM controlled form components.
61
74
  */
62
75
  var LinkedValueUtils = {
63
- Mixin: {
64
- propTypes: {
65
- value: function (props, propName, componentName) {
66
- if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
67
- return null;
68
- }
69
- return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
70
- },
71
- checked: function (props, propName, componentName) {
72
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
73
- return null;
74
- }
75
- return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
76
- },
77
- onChange: ReactPropTypes.func
76
+ checkPropTypes: function (tagName, props, owner) {
77
+ for (var propName in propTypes) {
78
+ if (propTypes.hasOwnProperty(propName)) {
79
+ var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
80
+ }
81
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
82
+ // Only monitor this failure once because there tends to be a lot of the
83
+ // same error.
84
+ loggedTypeFailures[error.message] = true;
85
+
86
+ var addendum = getDeclarationErrorAddendum(owner);
87
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
88
+ }
78
89
  }
79
90
  },
80
91
 
@@ -105,17 +116,18 @@ var LinkedValueUtils = {
105
116
 
106
117
  /**
107
118
  * @param {object} inputProps Props for form component
108
- * @return {function} change callback either from onChange prop or link.
119
+ * @param {SyntheticEvent} event change event to handle
109
120
  */
110
- getOnChange: function (inputProps) {
121
+ executeOnChange: function (inputProps, event) {
111
122
  if (inputProps.valueLink) {
112
123
  _assertValueLink(inputProps);
113
- return _handleLinkedValueChange;
124
+ return inputProps.valueLink.requestChange(event.target.value);
114
125
  } else if (inputProps.checkedLink) {
115
126
  _assertCheckedLink(inputProps);
116
- return _handleLinkedCheckChange;
127
+ return inputProps.checkedLink.requestChange(event.target.checked);
128
+ } else if (inputProps.onChange) {
129
+ return inputProps.onChange.call(undefined, event);
117
130
  }
118
- return inputProps.onChange;
119
131
  }
120
132
  };
121
133