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,16 +12,37 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var DOMProperty = require("./DOMProperty");
15
+ var DOMProperty = require('./DOMProperty');
16
16
 
17
- var quoteAttributeValueForBrowser = require("./quoteAttributeValueForBrowser");
18
- var warning = require("./warning");
17
+ var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser');
18
+ var warning = require('fbjs/lib/warning');
19
19
 
20
- function shouldIgnoreValue(name, value) {
21
- return value == null || DOMProperty.hasBooleanValue[name] && !value || DOMProperty.hasNumericValue[name] && isNaN(value) || DOMProperty.hasPositiveNumericValue[name] && value < 1 || DOMProperty.hasOverloadedBooleanValue[name] && value === false;
20
+ // Simplified subset
21
+ var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
22
+ var illegalAttributeNameCache = {};
23
+ var validatedAttributeNameCache = {};
24
+
25
+ function isAttributeNameSafe(attributeName) {
26
+ if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
27
+ return true;
28
+ }
29
+ if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
30
+ return false;
31
+ }
32
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
33
+ validatedAttributeNameCache[attributeName] = true;
34
+ return true;
35
+ }
36
+ illegalAttributeNameCache[attributeName] = true;
37
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
38
+ return false;
22
39
  }
23
40
 
24
- if ('production' !== process.env.NODE_ENV) {
41
+ function shouldIgnoreValue(propertyInfo, value) {
42
+ return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
43
+ }
44
+
45
+ if (process.env.NODE_ENV !== 'production') {
25
46
  var reactProps = {
26
47
  children: true,
27
48
  dangerouslySetInnerHTML: true,
@@ -43,7 +64,7 @@ if ('production' !== process.env.NODE_ENV) {
43
64
 
44
65
  // For now, only warn when we have a suggested correction. This prevents
45
66
  // logging too much when using transferPropsTo.
46
- 'production' !== process.env.NODE_ENV ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
67
+ process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
47
68
  };
48
69
  }
49
70
 
@@ -62,6 +83,10 @@ var DOMPropertyOperations = {
62
83
  return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
63
84
  },
64
85
 
86
+ setAttributeForID: function (node, id) {
87
+ node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
88
+ },
89
+
65
90
  /**
66
91
  * Creates markup for a property.
67
92
  *
@@ -70,12 +95,13 @@ var DOMPropertyOperations = {
70
95
  * @return {?string} Markup string, or null if the property was invalid.
71
96
  */
72
97
  createMarkupForProperty: function (name, value) {
73
- if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) {
74
- if (shouldIgnoreValue(name, value)) {
98
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
99
+ if (propertyInfo) {
100
+ if (shouldIgnoreValue(propertyInfo, value)) {
75
101
  return '';
76
102
  }
77
- var attributeName = DOMProperty.getAttributeName[name];
78
- if (DOMProperty.hasBooleanValue[name] || DOMProperty.hasOverloadedBooleanValue[name] && value === true) {
103
+ var attributeName = propertyInfo.attributeName;
104
+ if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
79
105
  return attributeName + '=""';
80
106
  }
81
107
  return attributeName + '=' + quoteAttributeValueForBrowser(value);
@@ -84,12 +110,26 @@ var DOMPropertyOperations = {
84
110
  return '';
85
111
  }
86
112
  return name + '=' + quoteAttributeValueForBrowser(value);
87
- } else if ('production' !== process.env.NODE_ENV) {
113
+ } else if (process.env.NODE_ENV !== 'production') {
88
114
  warnUnknownProperty(name);
89
115
  }
90
116
  return null;
91
117
  },
92
118
 
119
+ /**
120
+ * Creates markup for a custom property.
121
+ *
122
+ * @param {string} name
123
+ * @param {*} value
124
+ * @return {string} Markup string, or empty string if the property was invalid.
125
+ */
126
+ createMarkupForCustomAttribute: function (name, value) {
127
+ if (!isAttributeNameSafe(name) || value == null) {
128
+ return '';
129
+ }
130
+ return name + '=' + quoteAttributeValueForBrowser(value);
131
+ },
132
+
93
133
  /**
94
134
  * Sets the value for a property on a node.
95
135
  *
@@ -98,43 +138,53 @@ var DOMPropertyOperations = {
98
138
  * @param {*} value
99
139
  */
100
140
  setValueForProperty: function (node, name, value) {
101
- if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) {
102
- var mutationMethod = DOMProperty.getMutationMethod[name];
141
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
142
+ if (propertyInfo) {
143
+ var mutationMethod = propertyInfo.mutationMethod;
103
144
  if (mutationMethod) {
104
145
  mutationMethod(node, value);
105
- } else if (shouldIgnoreValue(name, value)) {
146
+ } else if (shouldIgnoreValue(propertyInfo, value)) {
106
147
  this.deleteValueForProperty(node, name);
107
- } else if (DOMProperty.mustUseAttribute[name]) {
108
- var attributeName = DOMProperty.getAttributeName[name];
109
- var namespace = DOMProperty.getAttributeNamespace[name];
148
+ } else if (propertyInfo.mustUseAttribute) {
149
+ var attributeName = propertyInfo.attributeName;
150
+ var namespace = propertyInfo.attributeNamespace;
110
151
  // `setAttribute` with objects becomes only `[object]` in IE8/9,
111
152
  // ('' + value) makes it output the correct toString()-value.
112
153
  if (namespace) {
113
154
  node.setAttributeNS(namespace, attributeName, '' + value);
155
+ } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
156
+ node.setAttribute(attributeName, '');
114
157
  } else {
115
158
  node.setAttribute(attributeName, '' + value);
116
159
  }
117
160
  } else {
118
- var propName = DOMProperty.getPropertyName[name];
161
+ var propName = propertyInfo.propertyName;
119
162
  // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
120
163
  // property type before comparing; only `value` does and is string.
121
- if (!DOMProperty.hasSideEffects[name] || '' + node[propName] !== '' + value) {
164
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
122
165
  // Contrary to `setAttribute`, object properties are properly
123
166
  // `toString`ed by IE8/9.
124
167
  node[propName] = value;
125
168
  }
126
169
  }
127
170
  } else if (DOMProperty.isCustomAttribute(name)) {
128
- if (value == null) {
129
- node.removeAttribute(name);
130
- } else {
131
- node.setAttribute(name, '' + value);
132
- }
133
- } else if ('production' !== process.env.NODE_ENV) {
171
+ DOMPropertyOperations.setValueForAttribute(node, name, value);
172
+ } else if (process.env.NODE_ENV !== 'production') {
134
173
  warnUnknownProperty(name);
135
174
  }
136
175
  },
137
176
 
177
+ setValueForAttribute: function (node, name, value) {
178
+ if (!isAttributeNameSafe(name)) {
179
+ return;
180
+ }
181
+ if (value == null) {
182
+ node.removeAttribute(name);
183
+ } else {
184
+ node.setAttribute(name, '' + value);
185
+ }
186
+ },
187
+
138
188
  /**
139
189
  * Deletes the value for a property on a node.
140
190
  *
@@ -142,22 +192,23 @@ var DOMPropertyOperations = {
142
192
  * @param {string} name
143
193
  */
144
194
  deleteValueForProperty: function (node, name) {
145
- if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) {
146
- var mutationMethod = DOMProperty.getMutationMethod[name];
195
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
196
+ if (propertyInfo) {
197
+ var mutationMethod = propertyInfo.mutationMethod;
147
198
  if (mutationMethod) {
148
199
  mutationMethod(node, undefined);
149
- } else if (DOMProperty.mustUseAttribute[name]) {
150
- node.removeAttribute(DOMProperty.getAttributeName[name]);
200
+ } else if (propertyInfo.mustUseAttribute) {
201
+ node.removeAttribute(propertyInfo.attributeName);
151
202
  } else {
152
- var propName = DOMProperty.getPropertyName[name];
203
+ var propName = propertyInfo.propertyName;
153
204
  var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
154
- if (!DOMProperty.hasSideEffects[name] || '' + node[propName] !== defaultValue) {
205
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
155
206
  node[propName] = defaultValue;
156
207
  }
157
208
  }
158
209
  } else if (DOMProperty.isCustomAttribute(name)) {
159
210
  node.removeAttribute(name);
160
- } else if ('production' !== process.env.NODE_ENV) {
211
+ } else if (process.env.NODE_ENV !== 'production') {
161
212
  warnUnknownProperty(name);
162
213
  }
163
214
  }
package/lib/Danger.js CHANGED
@@ -12,12 +12,12 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var ExecutionEnvironment = require("./ExecutionEnvironment");
15
+ var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
16
16
 
17
- var createNodesFromMarkup = require("./createNodesFromMarkup");
18
- var emptyFunction = require("./emptyFunction");
19
- var getMarkupWrap = require("./getMarkupWrap");
20
- var invariant = require("./invariant");
17
+ var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
18
+ var emptyFunction = require('fbjs/lib/emptyFunction');
19
+ var getMarkupWrap = require('fbjs/lib/getMarkupWrap');
20
+ var invariant = require('fbjs/lib/invariant');
21
21
 
22
22
  var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
23
23
  var RESULT_INDEX_ATTR = 'data-danger-index';
@@ -49,12 +49,12 @@ var Danger = {
49
49
  * @internal
50
50
  */
51
51
  dangerouslyRenderMarkup: function (markupList) {
52
- !ExecutionEnvironment.canUseDOM ? 'production' !== process.env.NODE_ENV ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'React.renderToString for server rendering.') : invariant(false) : undefined;
52
+ !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
53
53
  var nodeName;
54
54
  var markupByNodeName = {};
55
55
  // Group markup by `nodeName` if a wrap is necessary, else by '*'.
56
56
  for (var i = 0; i < markupList.length; i++) {
57
- !markupList[i] ? 'production' !== process.env.NODE_ENV ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
57
+ !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
58
58
  nodeName = getNodeName(markupList[i]);
59
59
  nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
60
60
  markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -96,14 +96,14 @@ var Danger = {
96
96
  resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
97
97
  renderNode.removeAttribute(RESULT_INDEX_ATTR);
98
98
 
99
- !!resultList.hasOwnProperty(resultIndex) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
99
+ !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
100
100
 
101
101
  resultList[resultIndex] = renderNode;
102
102
 
103
103
  // This should match resultList.length and markupList.length when
104
104
  // we're done.
105
105
  resultListAssignmentCount += 1;
106
- } else if ('production' !== process.env.NODE_ENV) {
106
+ } else if (process.env.NODE_ENV !== 'production') {
107
107
  console.error('Danger: Discarding unexpected node:', renderNode);
108
108
  }
109
109
  }
@@ -111,9 +111,9 @@ var Danger = {
111
111
 
112
112
  // Although resultList was populated out of order, it should now be a dense
113
113
  // array.
114
- !(resultListAssignmentCount === resultList.length) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
114
+ !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
115
115
 
116
- !(resultList.length === markupList.length) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
116
+ !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
117
117
 
118
118
  return resultList;
119
119
  },
@@ -127,11 +127,16 @@ var Danger = {
127
127
  * @internal
128
128
  */
129
129
  dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
130
- !ExecutionEnvironment.canUseDOM ? 'production' !== process.env.NODE_ENV ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'React.renderToString for server rendering.') : invariant(false) : undefined;
131
- !markup ? 'production' !== process.env.NODE_ENV ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
132
- !(oldChild.tagName.toLowerCase() !== 'html') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See React.renderToString().') : invariant(false) : undefined;
133
-
134
- var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
130
+ !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
131
+ !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
132
+ !(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
133
+
134
+ var newChild;
135
+ if (typeof markup === 'string') {
136
+ newChild = createNodesFromMarkup(markup, emptyFunction)[0];
137
+ } else {
138
+ newChild = markup;
139
+ }
135
140
  oldChild.parentNode.replaceChild(newChild, oldChild);
136
141
  }
137
142
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var keyOf = require("./keyOf");
14
+ var keyOf = require('fbjs/lib/keyOf');
15
15
 
16
16
  /**
17
17
  * Module that is injectable into `EventPluginHub`, that specifies a
@@ -22,6 +22,6 @@ var keyOf = require("./keyOf");
22
22
  * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
23
23
  * preventing default on events is convenient in `SimpleEventPlugin` handlers.
24
24
  */
25
- var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null }), keyOf({ AnalyticsEventPlugin: null })];
25
+ var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
26
26
 
27
27
  module.exports = DefaultEventPluginOrder;
@@ -12,12 +12,12 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var EventConstants = require("./EventConstants");
16
- var EventPropagators = require("./EventPropagators");
17
- var SyntheticMouseEvent = require("./SyntheticMouseEvent");
15
+ var EventConstants = require('./EventConstants');
16
+ var EventPropagators = require('./EventPropagators');
17
+ var SyntheticMouseEvent = require('./SyntheticMouseEvent');
18
18
 
19
- var ReactMount = require("./ReactMount");
20
- var keyOf = require("./keyOf");
19
+ var ReactMount = require('./ReactMount');
20
+ var keyOf = require('fbjs/lib/keyOf');
21
21
 
22
22
  var topLevelTypes = EventConstants.topLevelTypes;
23
23
  var getFirstReactDOM = ReactMount.getFirstReactDOM;
@@ -53,7 +53,7 @@ var EnterLeaveEventPlugin = {
53
53
  * @return {*} An accumulation of synthetic events.
54
54
  * @see {EventPluginHub.extractEvents}
55
55
  */
56
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
56
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
57
57
  if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
58
58
  return null;
59
59
  }
@@ -76,13 +76,24 @@ var EnterLeaveEventPlugin = {
76
76
  }
77
77
  }
78
78
 
79
- var from, to;
79
+ var from;
80
+ var to;
81
+ var fromID = '';
82
+ var toID = '';
80
83
  if (topLevelType === topLevelTypes.topMouseOut) {
81
84
  from = topLevelTarget;
82
- to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) || win;
85
+ fromID = topLevelTargetID;
86
+ to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
87
+ if (to) {
88
+ toID = ReactMount.getID(to);
89
+ } else {
90
+ to = win;
91
+ }
92
+ to = to || win;
83
93
  } else {
84
94
  from = win;
85
95
  to = topLevelTarget;
96
+ toID = topLevelTargetID;
86
97
  }
87
98
 
88
99
  if (from === to) {
@@ -90,15 +101,12 @@ var EnterLeaveEventPlugin = {
90
101
  return null;
91
102
  }
92
103
 
93
- var fromID = from ? ReactMount.getID(from) : '';
94
- var toID = to ? ReactMount.getID(to) : '';
95
-
96
- var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent);
104
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
97
105
  leave.type = 'mouseleave';
98
106
  leave.target = from;
99
107
  leave.relatedTarget = to;
100
108
 
101
- var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent);
109
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
102
110
  enter.type = 'mouseenter';
103
111
  enter.target = to;
104
112
  enter.relatedTarget = from;
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var keyMirror = require("./keyMirror");
14
+ var keyMirror = require('fbjs/lib/keyMirror');
15
15
 
16
16
  var PropagationPhases = keyMirror({ bubbled: null, captured: null });
17
17
 
@@ -19,7 +19,10 @@ var PropagationPhases = keyMirror({ bubbled: null, captured: null });
19
19
  * Types of raw signals from the browser caught at the top level.
20
20
  */
21
21
  var topLevelTypes = keyMirror({
22
+ topAbort: null,
22
23
  topBlur: null,
24
+ topCanPlay: null,
25
+ topCanPlayThrough: null,
23
26
  topChange: null,
24
27
  topClick: null,
25
28
  topCompositionEnd: null,
@@ -37,6 +40,10 @@ var topLevelTypes = keyMirror({
37
40
  topDragOver: null,
38
41
  topDragStart: null,
39
42
  topDrop: null,
43
+ topDurationChange: null,
44
+ topEmptied: null,
45
+ topEncrypted: null,
46
+ topEnded: null,
40
47
  topError: null,
41
48
  topFocus: null,
42
49
  topInput: null,
@@ -44,21 +51,36 @@ var topLevelTypes = keyMirror({
44
51
  topKeyPress: null,
45
52
  topKeyUp: null,
46
53
  topLoad: null,
54
+ topLoadedData: null,
55
+ topLoadedMetadata: null,
56
+ topLoadStart: null,
47
57
  topMouseDown: null,
48
58
  topMouseMove: null,
49
59
  topMouseOut: null,
50
60
  topMouseOver: null,
51
61
  topMouseUp: null,
52
62
  topPaste: null,
63
+ topPause: null,
64
+ topPlay: null,
65
+ topPlaying: null,
66
+ topProgress: null,
67
+ topRateChange: null,
53
68
  topReset: null,
54
69
  topScroll: null,
70
+ topSeeked: null,
71
+ topSeeking: null,
55
72
  topSelectionChange: null,
73
+ topStalled: null,
56
74
  topSubmit: null,
75
+ topSuspend: null,
57
76
  topTextInput: null,
77
+ topTimeUpdate: null,
58
78
  topTouchCancel: null,
59
79
  topTouchEnd: null,
60
80
  topTouchMove: null,
61
81
  topTouchStart: null,
82
+ topVolumeChange: null,
83
+ topWaiting: null,
62
84
  topWheel: null
63
85
  });
64
86
 
@@ -11,13 +11,14 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var EventPluginRegistry = require("./EventPluginRegistry");
15
- var EventPluginUtils = require("./EventPluginUtils");
14
+ var EventPluginRegistry = require('./EventPluginRegistry');
15
+ var EventPluginUtils = require('./EventPluginUtils');
16
+ var ReactErrorUtils = require('./ReactErrorUtils');
16
17
 
17
- var accumulateInto = require("./accumulateInto");
18
- var forEachAccumulated = require("./forEachAccumulated");
19
- var invariant = require("./invariant");
20
- var warning = require("./warning");
18
+ var accumulateInto = require('./accumulateInto');
19
+ var forEachAccumulated = require('./forEachAccumulated');
20
+ var invariant = require('fbjs/lib/invariant');
21
+ var warning = require('fbjs/lib/warning');
21
22
 
22
23
  /**
23
24
  * Internal store for event listeners
@@ -38,13 +39,7 @@ var eventQueue = null;
38
39
  */
39
40
  var executeDispatchesAndRelease = function (event) {
40
41
  if (event) {
41
- var executeDispatch = EventPluginUtils.executeDispatch;
42
- // Plugins can provide custom behavior when dispatching events.
43
- var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
44
- if (PluginModule && PluginModule.executeDispatch) {
45
- executeDispatch = PluginModule.executeDispatch;
46
- }
47
- EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
42
+ EventPluginUtils.executeDispatchesInOrder(event);
48
43
 
49
44
  if (!event.isPersistent()) {
50
45
  event.constructor.release(event);
@@ -60,7 +55,7 @@ var InstanceHandle = null;
60
55
 
61
56
  function validateInstanceHandle() {
62
57
  var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
63
- 'production' !== process.env.NODE_ENV ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
58
+ process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
64
59
  }
65
60
 
66
61
  /**
@@ -104,13 +99,13 @@ var EventPluginHub = {
104
99
  */
105
100
  injectInstanceHandle: function (InjectedInstanceHandle) {
106
101
  InstanceHandle = InjectedInstanceHandle;
107
- if ('production' !== process.env.NODE_ENV) {
102
+ if (process.env.NODE_ENV !== 'production') {
108
103
  validateInstanceHandle();
109
104
  }
110
105
  },
111
106
 
112
107
  getInstanceHandle: function () {
113
- if ('production' !== process.env.NODE_ENV) {
108
+ if (process.env.NODE_ENV !== 'production') {
114
109
  validateInstanceHandle();
115
110
  }
116
111
  return InstanceHandle;
@@ -141,7 +136,7 @@ var EventPluginHub = {
141
136
  * @param {?function} listener The callback to store.
142
137
  */
143
138
  putListener: function (id, registrationName, listener) {
144
- !(typeof listener === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
139
+ !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
145
140
 
146
141
  var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
147
142
  bankForRegistrationName[id] = listener;
@@ -212,14 +207,14 @@ var EventPluginHub = {
212
207
  * @return {*} An accumulation of synthetic events.
213
208
  * @internal
214
209
  */
215
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
210
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
216
211
  var events;
217
212
  var plugins = EventPluginRegistry.plugins;
218
213
  for (var i = 0; i < plugins.length; i++) {
219
214
  // Not every plugin in the ordering may be loaded at runtime.
220
215
  var possiblePlugin = plugins[i];
221
216
  if (possiblePlugin) {
222
- var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent);
217
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
223
218
  if (extractedEvents) {
224
219
  events = accumulateInto(events, extractedEvents);
225
220
  }
@@ -252,7 +247,9 @@ var EventPluginHub = {
252
247
  var processingEventQueue = eventQueue;
253
248
  eventQueue = null;
254
249
  forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
255
- !!eventQueue ? 'production' !== process.env.NODE_ENV ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
250
+ !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
251
+ // This would be a good time to rethrow if any of the event handlers threw.
252
+ ReactErrorUtils.rethrowCaughtError();
256
253
  },
257
254
 
258
255
  /**