react 0.14.10 → 15.0.0

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 (193) hide show
  1. package/LICENSE +1 -1
  2. package/dist/react-with-addons.js +4900 -4627
  3. package/dist/react-with-addons.min.js +7 -7
  4. package/dist/react.js +4556 -4059
  5. package/dist/react.min.js +7 -7
  6. package/lib/AutoFocusUtils.js +3 -15
  7. package/lib/BeforeInputEventPlugin.js +8 -25
  8. package/lib/CSSProperty.js +10 -1
  9. package/lib/CSSPropertyOperations.js +49 -19
  10. package/lib/CallbackQueue.js +16 -4
  11. package/lib/ChangeEventPlugin.js +58 -54
  12. package/lib/DOMChildrenOperations.js +91 -61
  13. package/lib/DOMLazyTree.js +105 -0
  14. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  15. package/lib/DOMProperty.js +18 -39
  16. package/lib/DOMPropertyOperations.js +42 -53
  17. package/lib/Danger.js +13 -14
  18. package/lib/DefaultEventPluginOrder.js +1 -1
  19. package/lib/EnterLeaveEventPlugin.js +24 -43
  20. package/lib/EventConstants.js +6 -1
  21. package/lib/EventPluginHub.js +22 -66
  22. package/lib/EventPluginRegistry.js +30 -9
  23. package/lib/EventPluginUtils.js +61 -36
  24. package/lib/EventPropagators.js +19 -17
  25. package/lib/FallbackCompositionState.js +4 -4
  26. package/lib/HTMLDOMPropertyConfig.js +131 -152
  27. package/lib/LinkedStateMixin.js +1 -2
  28. package/lib/LinkedValueUtils.js +6 -7
  29. package/lib/MetaMatchers.js +2 -2
  30. package/lib/OrderedMap.js +17 -16
  31. package/lib/PooledClass.js +2 -2
  32. package/lib/React.js +50 -20
  33. package/lib/ReactBrowserEventEmitter.js +19 -26
  34. package/lib/ReactCSSTransitionGroup.js +4 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  36. package/lib/ReactChildReconciler.js +15 -13
  37. package/lib/ReactChildren.js +5 -4
  38. package/lib/ReactClass.js +44 -92
  39. package/lib/ReactComponent.js +9 -10
  40. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  41. package/lib/ReactComponentEnvironment.js +4 -4
  42. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  43. package/lib/ReactCompositeComponent.js +166 -74
  44. package/lib/ReactCurrentOwner.js +2 -1
  45. package/lib/ReactDOM.js +27 -15
  46. package/lib/ReactDOMButton.js +2 -2
  47. package/lib/ReactDOMComponent.js +186 -250
  48. package/lib/ReactDOMComponentFlags.js +18 -0
  49. package/lib/ReactDOMComponentTree.js +186 -0
  50. package/lib/ReactDOMContainerInfo.js +32 -0
  51. package/lib/ReactDOMDebugTool.js +61 -0
  52. package/lib/ReactDOMEmptyComponent.js +60 -0
  53. package/lib/ReactDOMFactories.js +1 -2
  54. package/lib/ReactDOMFeatureFlags.js +2 -2
  55. package/lib/ReactDOMIDOperations.js +5 -60
  56. package/lib/ReactDOMInput.js +73 -23
  57. package/lib/ReactDOMInstrumentation.js +16 -0
  58. package/lib/ReactDOMOption.js +14 -12
  59. package/lib/ReactDOMSelect.js +43 -19
  60. package/lib/ReactDOMSelection.js +4 -4
  61. package/lib/ReactDOMServer.js +1 -1
  62. package/lib/ReactDOMTextComponent.js +87 -45
  63. package/lib/ReactDOMTextarea.js +39 -11
  64. package/lib/ReactDOMTreeTraversal.js +134 -0
  65. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  66. package/lib/ReactDebugInstanceMap.js +102 -0
  67. package/lib/ReactDebugTool.js +72 -0
  68. package/lib/ReactDefaultBatchingStrategy.js +4 -3
  69. package/lib/ReactDefaultInjection.js +11 -15
  70. package/lib/ReactDefaultPerf.js +105 -26
  71. package/lib/ReactDefaultPerfAnalysis.js +23 -15
  72. package/lib/ReactElement.js +63 -23
  73. package/lib/ReactElementValidator.js +9 -9
  74. package/lib/ReactEmptyComponent.js +8 -33
  75. package/lib/ReactErrorUtils.js +1 -2
  76. package/lib/ReactEventEmitterMixin.js +3 -8
  77. package/lib/ReactEventListener.js +23 -77
  78. package/lib/ReactFeatureFlags.js +21 -0
  79. package/lib/ReactFragment.js +6 -6
  80. package/lib/ReactInjection.js +3 -3
  81. package/lib/ReactInputSelection.js +4 -4
  82. package/lib/ReactInstanceHandles.js +10 -12
  83. package/lib/ReactInstanceMap.js +2 -1
  84. package/lib/ReactInstrumentation.js +16 -0
  85. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  86. package/lib/ReactLink.js +2 -3
  87. package/lib/ReactMarkupChecksum.js +8 -3
  88. package/lib/ReactMount.js +88 -460
  89. package/lib/ReactMultiChild.js +106 -200
  90. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  91. package/lib/ReactNativeComponent.js +6 -5
  92. package/lib/ReactNodeTypes.js +37 -0
  93. package/lib/ReactNoopUpdateQueue.js +2 -25
  94. package/lib/ReactOwner.js +7 -6
  95. package/lib/ReactPerf.js +2 -2
  96. package/lib/ReactPropTransferer.js +5 -4
  97. package/lib/ReactPropTypeLocationNames.js +1 -1
  98. package/lib/ReactPropTypeLocations.js +1 -1
  99. package/lib/ReactPropTypes.js +31 -7
  100. package/lib/ReactReconcileTransaction.js +20 -9
  101. package/lib/ReactReconciler.js +29 -6
  102. package/lib/ReactRef.js +1 -1
  103. package/lib/ReactServerBatchingStrategy.js +1 -2
  104. package/lib/ReactServerRendering.js +17 -35
  105. package/lib/ReactServerRenderingTransaction.js +11 -29
  106. package/lib/ReactSimpleEmptyComponent.js +36 -0
  107. package/lib/ReactStateSetters.js +1 -1
  108. package/lib/ReactTestUtils.js +47 -28
  109. package/lib/ReactTransitionChildMapping.js +1 -2
  110. package/lib/ReactTransitionEvents.js +8 -44
  111. package/lib/ReactTransitionGroup.js +4 -3
  112. package/lib/ReactUMDEntry.js +26 -0
  113. package/lib/ReactUpdateQueue.js +24 -66
  114. package/lib/ReactUpdates.js +29 -11
  115. package/lib/ReactVersion.js +2 -2
  116. package/lib/ReactWithAddons.js +1 -21
  117. package/lib/ReactWithAddonsUMDEntry.js +26 -0
  118. package/lib/ResponderEventPlugin.js +54 -66
  119. package/lib/ResponderSyntheticEvent.js +2 -3
  120. package/lib/ResponderTouchHistoryStore.js +5 -5
  121. package/lib/SVGDOMPropertyConfig.js +267 -94
  122. package/lib/SelectEventPlugin.js +13 -18
  123. package/lib/SimpleEventPlugin.js +57 -17
  124. package/lib/SyntheticAnimationEvent.js +39 -0
  125. package/lib/SyntheticClipboardEvent.js +2 -3
  126. package/lib/SyntheticCompositionEvent.js +2 -3
  127. package/lib/SyntheticDragEvent.js +2 -3
  128. package/lib/SyntheticEvent.js +102 -21
  129. package/lib/SyntheticFocusEvent.js +2 -3
  130. package/lib/SyntheticInputEvent.js +2 -3
  131. package/lib/SyntheticKeyboardEvent.js +2 -3
  132. package/lib/SyntheticMouseEvent.js +2 -3
  133. package/lib/SyntheticTouchEvent.js +2 -3
  134. package/lib/SyntheticTransitionEvent.js +39 -0
  135. package/lib/SyntheticUIEvent.js +2 -3
  136. package/lib/SyntheticWheelEvent.js +2 -3
  137. package/lib/TapEventPlugin.js +3 -12
  138. package/lib/Transaction.js +3 -3
  139. package/lib/ViewportMetrics.js +1 -1
  140. package/lib/accumulate.js +2 -2
  141. package/lib/accumulateInto.js +2 -2
  142. package/lib/adler32.js +3 -2
  143. package/lib/canDefineProperty.js +1 -1
  144. package/lib/createHierarchyRenderer.js +1 -1
  145. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  146. package/lib/dangerousStyleValue.js +25 -3
  147. package/lib/deprecated.js +7 -4
  148. package/lib/escapeTextContentForBrowser.js +1 -1
  149. package/lib/findDOMNode.js +15 -8
  150. package/lib/flattenChildren.js +2 -2
  151. package/lib/forEachAccumulated.js +2 -1
  152. package/lib/getEventCharCode.js +2 -2
  153. package/lib/getEventKey.js +1 -2
  154. package/lib/getEventModifierState.js +1 -2
  155. package/lib/getEventTarget.js +8 -2
  156. package/lib/getIteratorFn.js +2 -2
  157. package/lib/getNativeComponentFromComposite.js +30 -0
  158. package/lib/getNodeForCharacterOffset.js +2 -1
  159. package/lib/getTestDocument.js +1 -1
  160. package/lib/getTextContentAccessor.js +1 -1
  161. package/lib/getVendorPrefixedEventName.js +101 -0
  162. package/lib/instantiateReactComponent.js +12 -13
  163. package/lib/isEventSupported.js +2 -2
  164. package/lib/isTextInputElement.js +2 -1
  165. package/lib/onlyChild.js +2 -2
  166. package/lib/quoteAttributeValueForBrowser.js +1 -1
  167. package/lib/reactComponentExpect.js +5 -4
  168. package/lib/renderSubtreeIntoContainer.js +1 -1
  169. package/lib/setInnerHTML.js +6 -14
  170. package/lib/setTextContent.js +1 -1
  171. package/lib/shallowCompare.js +1 -1
  172. package/lib/shouldUpdateReactComponent.js +2 -3
  173. package/lib/sliceChildren.js +1 -1
  174. package/lib/traverseAllChildren.js +8 -8
  175. package/lib/update.js +16 -15
  176. package/lib/validateDOMNesting.js +18 -13
  177. package/package.json +23 -32
  178. package/addons.js +0 -13
  179. package/cjs/react-jsx-dev-runtime.development.js +0 -861
  180. package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  181. package/cjs/react-jsx-runtime.development.js +0 -883
  182. package/cjs/react-jsx-runtime.production.min.js +0 -10
  183. package/jsx-dev-runtime.js +0 -7
  184. package/jsx-runtime.js +0 -7
  185. package/lib/Object.assign.js +0 -47
  186. package/lib/React.native.js +0 -5
  187. package/lib/ReactBrowserComponentMixin.js +0 -36
  188. package/lib/ReactEmptyComponentRegistry.js +0 -48
  189. package/lib/ReactIsomorphic.js +0 -74
  190. package/lib/ReactRootIndex.js +0 -29
  191. package/lib/ServerReactRootIndex.js +0 -29
  192. package/lib/cloneWithProps.js +0 -54
  193. package/lib/webcomponents.js +0 -6379
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,19 +7,18 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule DOMPropertyOperations
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
14
  var DOMProperty = require('./DOMProperty');
15
+ var ReactDOMInstrumentation = require('./ReactDOMInstrumentation');
16
16
  var ReactPerf = require('./ReactPerf');
17
17
 
18
18
  var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser');
19
19
  var warning = require('fbjs/lib/warning');
20
20
 
21
- // Simplified subset
22
- var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
21
+ var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
23
22
  var illegalAttributeNameCache = {};
24
23
  var validatedAttributeNameCache = {};
25
24
 
@@ -35,7 +34,7 @@ function isAttributeNameSafe(attributeName) {
35
34
  return true;
36
35
  }
37
36
  illegalAttributeNameCache[attributeName] = true;
38
- process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
37
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
39
38
  return false;
40
39
  }
41
40
 
@@ -43,32 +42,6 @@ function shouldIgnoreValue(propertyInfo, value) {
43
42
  return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
44
43
  }
45
44
 
46
- if (process.env.NODE_ENV !== 'production') {
47
- var reactProps = {
48
- children: true,
49
- dangerouslySetInnerHTML: true,
50
- key: true,
51
- ref: true
52
- };
53
- var warnedProperties = {};
54
-
55
- var warnUnknownProperty = function (name) {
56
- if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
57
- return;
58
- }
59
-
60
- warnedProperties[name] = true;
61
- var lowerCasedName = name.toLowerCase();
62
-
63
- // data-* attributes should be lowercase; suggest the lowercase version
64
- var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
65
-
66
- // For now, only warn when we have a suggested correction. This prevents
67
- // logging too much when using transferPropsTo.
68
- process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
69
- };
70
- }
71
-
72
45
  /**
73
46
  * Operations for dealing with DOM properties.
74
47
  */
@@ -88,6 +61,14 @@ var DOMPropertyOperations = {
88
61
  node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
89
62
  },
90
63
 
64
+ createMarkupForRoot: function () {
65
+ return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
66
+ },
67
+
68
+ setAttributeForRoot: function (node) {
69
+ node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
70
+ },
71
+
91
72
  /**
92
73
  * Creates markup for a property.
93
74
  *
@@ -96,6 +77,9 @@ var DOMPropertyOperations = {
96
77
  * @return {?string} Markup string, or null if the property was invalid.
97
78
  */
98
79
  createMarkupForProperty: function (name, value) {
80
+ if (process.env.NODE_ENV !== 'production') {
81
+ ReactDOMInstrumentation.debugTool.onCreateMarkupForProperty(name, value);
82
+ }
99
83
  var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
100
84
  if (propertyInfo) {
101
85
  if (shouldIgnoreValue(propertyInfo, value)) {
@@ -111,8 +95,6 @@ var DOMPropertyOperations = {
111
95
  return '';
112
96
  }
113
97
  return name + '=' + quoteAttributeValueForBrowser(value);
114
- } else if (process.env.NODE_ENV !== 'production') {
115
- warnUnknownProperty(name);
116
98
  }
117
99
  return null;
118
100
  },
@@ -139,6 +121,9 @@ var DOMPropertyOperations = {
139
121
  * @param {*} value
140
122
  */
141
123
  setValueForProperty: function (node, name, value) {
124
+ if (process.env.NODE_ENV !== 'production') {
125
+ ReactDOMInstrumentation.debugTool.onSetValueForProperty(node, name, value);
126
+ }
142
127
  var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
143
128
  if (propertyInfo) {
144
129
  var mutationMethod = propertyInfo.mutationMethod;
@@ -146,7 +131,17 @@ var DOMPropertyOperations = {
146
131
  mutationMethod(node, value);
147
132
  } else if (shouldIgnoreValue(propertyInfo, value)) {
148
133
  this.deleteValueForProperty(node, name);
149
- } else if (propertyInfo.mustUseAttribute) {
134
+ } else if (propertyInfo.mustUseProperty) {
135
+ var propName = propertyInfo.propertyName;
136
+ // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
137
+ // property type before comparing; only `value` does and is string.
138
+ // Must set `value` property if it is not null and not yet set.
139
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value || !node.hasAttribute(propertyInfo.attributeName)) {
140
+ // Contrary to `setAttribute`, object properties are properly
141
+ // `toString`ed by IE8/9.
142
+ node[propName] = value;
143
+ }
144
+ } else {
150
145
  var attributeName = propertyInfo.attributeName;
151
146
  var namespace = propertyInfo.attributeNamespace;
152
147
  // `setAttribute` with objects becomes only `[object]` in IE8/9,
@@ -158,20 +153,9 @@ var DOMPropertyOperations = {
158
153
  } else {
159
154
  node.setAttribute(attributeName, '' + value);
160
155
  }
161
- } else {
162
- var propName = propertyInfo.propertyName;
163
- // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
164
- // property type before comparing; only `value` does and is string.
165
- if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
166
- // Contrary to `setAttribute`, object properties are properly
167
- // `toString`ed by IE8/9.
168
- node[propName] = value;
169
- }
170
156
  }
171
157
  } else if (DOMProperty.isCustomAttribute(name)) {
172
158
  DOMPropertyOperations.setValueForAttribute(node, name, value);
173
- } else if (process.env.NODE_ENV !== 'production') {
174
- warnUnknownProperty(name);
175
159
  }
176
160
  },
177
161
 
@@ -193,24 +177,29 @@ var DOMPropertyOperations = {
193
177
  * @param {string} name
194
178
  */
195
179
  deleteValueForProperty: function (node, name) {
180
+ if (process.env.NODE_ENV !== 'production') {
181
+ ReactDOMInstrumentation.debugTool.onDeleteValueForProperty(node, name);
182
+ }
196
183
  var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
197
184
  if (propertyInfo) {
198
185
  var mutationMethod = propertyInfo.mutationMethod;
199
186
  if (mutationMethod) {
200
187
  mutationMethod(node, undefined);
201
- } else if (propertyInfo.mustUseAttribute) {
202
- node.removeAttribute(propertyInfo.attributeName);
203
- } else {
188
+ } else if (propertyInfo.mustUseProperty) {
204
189
  var propName = propertyInfo.propertyName;
205
- var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
206
- if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
207
- node[propName] = defaultValue;
190
+ if (propertyInfo.hasBooleanValue) {
191
+ // No HAS_SIDE_EFFECTS logic here, only `value` has it and is string.
192
+ node[propName] = false;
193
+ } else {
194
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '') {
195
+ node[propName] = '';
196
+ }
208
197
  }
198
+ } else {
199
+ node.removeAttribute(propertyInfo.attributeName);
209
200
  }
210
201
  } else if (DOMProperty.isCustomAttribute(name)) {
211
202
  node.removeAttribute(name);
212
- } else if (process.env.NODE_ENV !== 'production') {
213
- warnUnknownProperty(name);
214
203
  }
215
204
  }
216
205
 
package/lib/Danger.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,11 +7,11 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule Danger
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
14
+ var DOMLazyTree = require('./DOMLazyTree');
15
15
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
16
16
 
17
17
  var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
@@ -49,12 +49,12 @@ var Danger = {
49
49
  * @internal
50
50
  */
51
51
  dangerouslyRenderMarkup: function (markupList) {
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;
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) : void 0;
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] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
57
+ !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : void 0;
58
58
  nodeName = getNodeName(markupList[i]);
59
59
  nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
60
60
  markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -96,7 +96,7 @@ var Danger = {
96
96
  resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
97
97
  renderNode.removeAttribute(RESULT_INDEX_ATTR);
98
98
 
99
- !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? 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) : void 0;
100
100
 
101
101
  resultList[resultIndex] = renderNode;
102
102
 
@@ -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) ? process.env.NODE_ENV !== 'production' ? 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) : void 0;
115
115
 
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;
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) : void 0;
117
117
 
118
118
  return resultList;
119
119
  },
@@ -127,17 +127,16 @@ var Danger = {
127
127
  * @internal
128
128
  */
129
129
  dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
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;
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) : void 0;
131
+ !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : void 0;
132
+ !(oldChild.nodeName !== '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) : void 0;
133
133
 
134
- var newChild;
135
134
  if (typeof markup === 'string') {
136
- newChild = createNodesFromMarkup(markup, emptyFunction)[0];
135
+ var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
136
+ oldChild.parentNode.replaceChild(newChild, oldChild);
137
137
  } else {
138
- newChild = markup;
138
+ DOMLazyTree.replaceChildWithTree(oldChild, markup);
139
139
  }
140
- oldChild.parentNode.replaceChild(newChild, oldChild);
141
140
  }
142
141
 
143
142
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,20 +7,18 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule EnterLeaveEventPlugin
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
14
  var EventConstants = require('./EventConstants');
16
15
  var EventPropagators = require('./EventPropagators');
16
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
17
17
  var SyntheticMouseEvent = require('./SyntheticMouseEvent');
18
18
 
19
- var ReactMount = require('./ReactMount');
20
19
  var keyOf = require('fbjs/lib/keyOf');
21
20
 
22
21
  var topLevelTypes = EventConstants.topLevelTypes;
23
- var getFirstReactDOM = ReactMount.getFirstReactDOM;
24
22
 
25
23
  var eventTypes = {
26
24
  mouseEnter: {
@@ -33,8 +31,6 @@ var eventTypes = {
33
31
  }
34
32
  };
35
33
 
36
- var extractedEvents = [null, null];
37
-
38
34
  var EnterLeaveEventPlugin = {
39
35
 
40
36
  eventTypes: eventTypes,
@@ -45,15 +41,8 @@ var EnterLeaveEventPlugin = {
45
41
  * we do not extract duplicate events. However, moving the mouse into the
46
42
  * browser from outside will not fire a `mouseout` event. In this case, we use
47
43
  * the `mouseover` top-level event.
48
- *
49
- * @param {string} topLevelType Record from `EventConstants`.
50
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
51
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
52
- * @param {object} nativeEvent Native browser event.
53
- * @return {*} An accumulation of synthetic events.
54
- * @see {EventPluginHub.extractEvents}
55
44
  */
56
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
45
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
57
46
  if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
58
47
  return null;
59
48
  }
@@ -63,12 +52,12 @@ var EnterLeaveEventPlugin = {
63
52
  }
64
53
 
65
54
  var win;
66
- if (topLevelTarget.window === topLevelTarget) {
67
- // `topLevelTarget` is probably a window object.
68
- win = topLevelTarget;
55
+ if (nativeEventTarget.window === nativeEventTarget) {
56
+ // `nativeEventTarget` is probably a window object.
57
+ win = nativeEventTarget;
69
58
  } else {
70
59
  // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
71
- var doc = topLevelTarget.ownerDocument;
60
+ var doc = nativeEventTarget.ownerDocument;
72
61
  if (doc) {
73
62
  win = doc.defaultView || doc.parentWindow;
74
63
  } else {
@@ -78,22 +67,14 @@ var EnterLeaveEventPlugin = {
78
67
 
79
68
  var from;
80
69
  var to;
81
- var fromID = '';
82
- var toID = '';
83
70
  if (topLevelType === topLevelTypes.topMouseOut) {
84
- from = topLevelTarget;
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;
71
+ from = targetInst;
72
+ var related = nativeEvent.relatedTarget || nativeEvent.toElement;
73
+ to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
93
74
  } else {
94
- from = win;
95
- to = topLevelTarget;
96
- toID = topLevelTargetID;
75
+ // Moving to a node from outside the window.
76
+ from = null;
77
+ to = targetInst;
97
78
  }
98
79
 
99
80
  if (from === to) {
@@ -101,22 +82,22 @@ var EnterLeaveEventPlugin = {
101
82
  return null;
102
83
  }
103
84
 
104
- var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
85
+ var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
86
+ var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
87
+
88
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
105
89
  leave.type = 'mouseleave';
106
- leave.target = from;
107
- leave.relatedTarget = to;
90
+ leave.target = fromNode;
91
+ leave.relatedTarget = toNode;
108
92
 
109
- var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
93
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
110
94
  enter.type = 'mouseenter';
111
- enter.target = to;
112
- enter.relatedTarget = from;
113
-
114
- EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
95
+ enter.target = toNode;
96
+ enter.relatedTarget = fromNode;
115
97
 
116
- extractedEvents[0] = leave;
117
- extractedEvents[1] = enter;
98
+ EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
118
99
 
119
- return extractedEvents;
100
+ return [leave, enter];
120
101
  }
121
102
 
122
103
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -20,6 +20,9 @@ var PropagationPhases = keyMirror({ bubbled: null, captured: null });
20
20
  */
21
21
  var topLevelTypes = keyMirror({
22
22
  topAbort: null,
23
+ topAnimationEnd: null,
24
+ topAnimationIteration: null,
25
+ topAnimationStart: null,
23
26
  topBlur: null,
24
27
  topCanPlay: null,
25
28
  topCanPlayThrough: null,
@@ -47,6 +50,7 @@ var topLevelTypes = keyMirror({
47
50
  topError: null,
48
51
  topFocus: null,
49
52
  topInput: null,
53
+ topInvalid: null,
50
54
  topKeyDown: null,
51
55
  topKeyPress: null,
52
56
  topKeyUp: null,
@@ -79,6 +83,7 @@ var topLevelTypes = keyMirror({
79
83
  topTouchEnd: null,
80
84
  topTouchMove: null,
81
85
  topTouchStart: null,
86
+ topTransitionEnd: null,
82
87
  topVolumeChange: null,
83
88
  topWaiting: null,
84
89
  topWheel: null
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -18,7 +18,6 @@ var ReactErrorUtils = require('./ReactErrorUtils');
18
18
  var accumulateInto = require('./accumulateInto');
19
19
  var forEachAccumulated = require('./forEachAccumulated');
20
20
  var invariant = require('fbjs/lib/invariant');
21
- var warning = require('fbjs/lib/warning');
22
21
 
23
22
  /**
24
23
  * Internal store for event listeners
@@ -54,17 +53,6 @@ var executeDispatchesAndReleaseTopLevel = function (e) {
54
53
  return executeDispatchesAndRelease(e, false);
55
54
  };
56
55
 
57
- /**
58
- * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
59
- * hierarchy given ids of the logical DOM elements involved.
60
- */
61
- var InstanceHandle = null;
62
-
63
- function validateInstanceHandle() {
64
- var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
65
- process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
66
- }
67
-
68
56
  /**
69
57
  * This is a unified interface for event plugins to be installed and configured.
70
58
  *
@@ -94,30 +82,6 @@ var EventPluginHub = {
94
82
  */
95
83
  injection: {
96
84
 
97
- /**
98
- * @param {object} InjectedMount
99
- * @public
100
- */
101
- injectMount: EventPluginUtils.injection.injectMount,
102
-
103
- /**
104
- * @param {object} InjectedInstanceHandle
105
- * @public
106
- */
107
- injectInstanceHandle: function (InjectedInstanceHandle) {
108
- InstanceHandle = InjectedInstanceHandle;
109
- if (process.env.NODE_ENV !== 'production') {
110
- validateInstanceHandle();
111
- }
112
- },
113
-
114
- getInstanceHandle: function () {
115
- if (process.env.NODE_ENV !== 'production') {
116
- validateInstanceHandle();
117
- }
118
- return InstanceHandle;
119
- },
120
-
121
85
  /**
122
86
  * @param {array} InjectedEventPluginOrder
123
87
  * @public
@@ -131,75 +95,71 @@ var EventPluginHub = {
131
95
 
132
96
  },
133
97
 
134
- eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
135
-
136
- registrationNameModules: EventPluginRegistry.registrationNameModules,
137
-
138
98
  /**
139
99
  * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
140
100
  *
141
- * @param {string} id ID of the DOM element.
101
+ * @param {object} inst The instance, which is the source of events.
142
102
  * @param {string} registrationName Name of listener (e.g. `onClick`).
143
- * @param {?function} listener The callback to store.
103
+ * @param {function} listener The callback to store.
144
104
  */
145
- putListener: function (id, registrationName, listener) {
146
- !(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;
105
+ putListener: function (inst, registrationName, listener) {
106
+ !(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) : void 0;
147
107
 
148
108
  var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
149
- bankForRegistrationName[id] = listener;
109
+ bankForRegistrationName[inst._rootNodeID] = listener;
150
110
 
151
111
  var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
152
112
  if (PluginModule && PluginModule.didPutListener) {
153
- PluginModule.didPutListener(id, registrationName, listener);
113
+ PluginModule.didPutListener(inst, registrationName, listener);
154
114
  }
155
115
  },
156
116
 
157
117
  /**
158
- * @param {string} id ID of the DOM element.
118
+ * @param {object} inst The instance, which is the source of events.
159
119
  * @param {string} registrationName Name of listener (e.g. `onClick`).
160
120
  * @return {?function} The stored callback.
161
121
  */
162
- getListener: function (id, registrationName) {
122
+ getListener: function (inst, registrationName) {
163
123
  var bankForRegistrationName = listenerBank[registrationName];
164
- return bankForRegistrationName && bankForRegistrationName[id];
124
+ return bankForRegistrationName && bankForRegistrationName[inst._rootNodeID];
165
125
  },
166
126
 
167
127
  /**
168
128
  * Deletes a listener from the registration bank.
169
129
  *
170
- * @param {string} id ID of the DOM element.
130
+ * @param {object} inst The instance, which is the source of events.
171
131
  * @param {string} registrationName Name of listener (e.g. `onClick`).
172
132
  */
173
- deleteListener: function (id, registrationName) {
133
+ deleteListener: function (inst, registrationName) {
174
134
  var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
175
135
  if (PluginModule && PluginModule.willDeleteListener) {
176
- PluginModule.willDeleteListener(id, registrationName);
136
+ PluginModule.willDeleteListener(inst, registrationName);
177
137
  }
178
138
 
179
139
  var bankForRegistrationName = listenerBank[registrationName];
180
140
  // TODO: This should never be null -- when is it?
181
141
  if (bankForRegistrationName) {
182
- delete bankForRegistrationName[id];
142
+ delete bankForRegistrationName[inst._rootNodeID];
183
143
  }
184
144
  },
185
145
 
186
146
  /**
187
147
  * Deletes all listeners for the DOM element with the supplied ID.
188
148
  *
189
- * @param {string} id ID of the DOM element.
149
+ * @param {object} inst The instance, which is the source of events.
190
150
  */
191
- deleteAllListeners: function (id) {
151
+ deleteAllListeners: function (inst) {
192
152
  for (var registrationName in listenerBank) {
193
- if (!listenerBank[registrationName][id]) {
153
+ if (!listenerBank[registrationName][inst._rootNodeID]) {
194
154
  continue;
195
155
  }
196
156
 
197
157
  var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
198
158
  if (PluginModule && PluginModule.willDeleteListener) {
199
- PluginModule.willDeleteListener(id, registrationName);
159
+ PluginModule.willDeleteListener(inst, registrationName);
200
160
  }
201
161
 
202
- delete listenerBank[registrationName][id];
162
+ delete listenerBank[registrationName][inst._rootNodeID];
203
163
  }
204
164
  },
205
165
 
@@ -207,21 +167,17 @@ var EventPluginHub = {
207
167
  * Allows registered plugins an opportunity to extract events from top-level
208
168
  * native browser events.
209
169
  *
210
- * @param {string} topLevelType Record from `EventConstants`.
211
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
212
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
213
- * @param {object} nativeEvent Native browser event.
214
170
  * @return {*} An accumulation of synthetic events.
215
171
  * @internal
216
172
  */
217
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
173
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
218
174
  var events;
219
175
  var plugins = EventPluginRegistry.plugins;
220
176
  for (var i = 0; i < plugins.length; i++) {
221
177
  // Not every plugin in the ordering may be loaded at runtime.
222
178
  var possiblePlugin = plugins[i];
223
179
  if (possiblePlugin) {
224
- var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
180
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
225
181
  if (extractedEvents) {
226
182
  events = accumulateInto(events, extractedEvents);
227
183
  }
@@ -258,7 +214,7 @@ var EventPluginHub = {
258
214
  } else {
259
215
  forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
260
216
  }
261
- !!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;
217
+ !!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) : void 0;
262
218
  // This would be a good time to rethrow if any of the event handlers threw.
263
219
  ReactErrorUtils.rethrowCaughtError();
264
220
  },