react 0.14.8 → 15.0.0-rc.1

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 (184) hide show
  1. package/LICENSE +1 -1
  2. package/addons.js +2 -0
  3. package/dist/react-with-addons.js +4203 -4148
  4. package/dist/react-with-addons.min.js +7 -7
  5. package/dist/react.js +4159 -3850
  6. package/dist/react.min.js +7 -7
  7. package/lib/AutoFocusUtils.js +3 -15
  8. package/lib/BeforeInputEventPlugin.js +8 -25
  9. package/lib/CSSProperty.js +4 -1
  10. package/lib/CSSPropertyOperations.js +24 -10
  11. package/lib/CallbackQueue.js +13 -2
  12. package/lib/ChangeEventPlugin.js +58 -54
  13. package/lib/DOMChildrenOperations.js +93 -60
  14. package/lib/DOMLazyTree.js +96 -0
  15. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  16. package/lib/DOMProperty.js +18 -39
  17. package/lib/DOMPropertyOperations.js +87 -53
  18. package/lib/Danger.js +13 -14
  19. package/lib/DefaultEventPluginOrder.js +1 -1
  20. package/lib/EnterLeaveEventPlugin.js +24 -43
  21. package/lib/EventConstants.js +6 -1
  22. package/lib/EventPluginHub.js +22 -66
  23. package/lib/EventPluginRegistry.js +30 -9
  24. package/lib/EventPluginUtils.js +61 -36
  25. package/lib/EventPropagators.js +19 -17
  26. package/lib/FallbackCompositionState.js +1 -2
  27. package/lib/HTMLDOMPropertyConfig.js +69 -90
  28. package/lib/LinkedStateMixin.js +1 -2
  29. package/lib/LinkedValueUtils.js +5 -6
  30. package/lib/MetaMatchers.js +2 -2
  31. package/lib/Object.assign.js +1 -1
  32. package/lib/OrderedMap.js +14 -14
  33. package/lib/PooledClass.js +2 -2
  34. package/lib/React.js +1 -13
  35. package/lib/ReactBrowserEventEmitter.js +16 -24
  36. package/lib/ReactCSSTransitionGroup.js +1 -2
  37. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  38. package/lib/ReactChildReconciler.js +15 -13
  39. package/lib/ReactChildren.js +5 -4
  40. package/lib/ReactClass.js +37 -86
  41. package/lib/ReactComponent.js +7 -8
  42. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  43. package/lib/ReactComponentEnvironment.js +4 -4
  44. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  45. package/lib/ReactCompositeComponent.js +160 -69
  46. package/lib/ReactCurrentOwner.js +2 -1
  47. package/lib/ReactDOM.js +27 -15
  48. package/lib/ReactDOMButton.js +2 -2
  49. package/lib/ReactDOMComponent.js +188 -244
  50. package/lib/ReactDOMComponentFlags.js +18 -0
  51. package/lib/ReactDOMComponentTree.js +186 -0
  52. package/lib/ReactDOMContainerInfo.js +32 -0
  53. package/lib/ReactDOMDebugTool.js +69 -0
  54. package/lib/ReactDOMEmptyComponent.js +60 -0
  55. package/lib/ReactDOMFactories.js +1 -2
  56. package/lib/ReactDOMFeatureFlags.js +2 -2
  57. package/lib/ReactDOMIDOperations.js +5 -60
  58. package/lib/ReactDOMInput.js +71 -22
  59. package/lib/ReactDOMInstrumentation.js +16 -0
  60. package/lib/ReactDOMOption.js +11 -10
  61. package/lib/ReactDOMSVGDeprecatedAttributeDevtool.js +61 -0
  62. package/lib/ReactDOMSelect.js +40 -17
  63. package/lib/ReactDOMSelection.js +4 -4
  64. package/lib/ReactDOMServer.js +1 -1
  65. package/lib/ReactDOMTextComponent.js +84 -43
  66. package/lib/ReactDOMTextarea.js +36 -9
  67. package/lib/ReactDOMTreeTraversal.js +134 -0
  68. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  69. package/lib/ReactDebugTool.js +72 -0
  70. package/lib/ReactDefaultBatchingStrategy.js +1 -1
  71. package/lib/ReactDefaultInjection.js +11 -15
  72. package/lib/ReactDefaultPerf.js +59 -19
  73. package/lib/ReactDefaultPerfAnalysis.js +17 -9
  74. package/lib/ReactElement.js +60 -21
  75. package/lib/ReactElementValidator.js +8 -8
  76. package/lib/ReactEmptyComponent.js +8 -33
  77. package/lib/ReactErrorUtils.js +1 -2
  78. package/lib/ReactEventEmitterMixin.js +3 -8
  79. package/lib/ReactEventListener.js +20 -75
  80. package/lib/ReactFeatureFlags.js +21 -0
  81. package/lib/ReactFragment.js +6 -6
  82. package/lib/ReactInjection.js +3 -3
  83. package/lib/ReactInputSelection.js +4 -4
  84. package/lib/ReactInstanceHandles.js +10 -12
  85. package/lib/ReactInstanceMap.js +2 -1
  86. package/lib/ReactInstrumentation.js +16 -0
  87. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  88. package/lib/ReactIsomorphic.js +1 -1
  89. package/lib/ReactLink.js +2 -3
  90. package/lib/ReactMarkupChecksum.js +1 -1
  91. package/lib/ReactMount.js +87 -460
  92. package/lib/ReactMultiChild.js +106 -200
  93. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  94. package/lib/ReactNativeComponent.js +3 -3
  95. package/lib/ReactNodeTypes.js +37 -0
  96. package/lib/ReactNoopUpdateQueue.js +2 -25
  97. package/lib/ReactOwner.js +3 -3
  98. package/lib/ReactPerf.js +2 -2
  99. package/lib/ReactPropTransferer.js +1 -1
  100. package/lib/ReactPropTypeLocationNames.js +1 -1
  101. package/lib/ReactPropTypeLocations.js +1 -1
  102. package/lib/ReactPropTypes.js +27 -3
  103. package/lib/ReactReconcileTransaction.js +17 -6
  104. package/lib/ReactReconciler.js +29 -6
  105. package/lib/ReactRef.js +1 -1
  106. package/lib/ReactServerBatchingStrategy.js +1 -2
  107. package/lib/ReactServerRendering.js +17 -35
  108. package/lib/ReactServerRenderingTransaction.js +8 -26
  109. package/lib/ReactSimpleEmptyComponent.js +36 -0
  110. package/lib/ReactStateSetters.js +1 -1
  111. package/lib/ReactTestUtils.js +33 -24
  112. package/lib/ReactTransitionChildMapping.js +1 -2
  113. package/lib/ReactTransitionEvents.js +8 -44
  114. package/lib/ReactTransitionGroup.js +1 -1
  115. package/lib/ReactUpdateQueue.js +6 -65
  116. package/lib/ReactUpdates.js +26 -9
  117. package/lib/ReactVersion.js +2 -2
  118. package/lib/ReactWithAddons.js +1 -14
  119. package/lib/ResponderEventPlugin.js +54 -66
  120. package/lib/ResponderSyntheticEvent.js +1 -2
  121. package/lib/ResponderTouchHistoryStore.js +5 -5
  122. package/lib/SVGDOMPropertyConfig.js +25 -66
  123. package/lib/SelectEventPlugin.js +13 -18
  124. package/lib/SimpleEventPlugin.js +57 -17
  125. package/lib/SyntheticAnimationEvent.js +39 -0
  126. package/lib/SyntheticClipboardEvent.js +2 -3
  127. package/lib/SyntheticCompositionEvent.js +2 -3
  128. package/lib/SyntheticDragEvent.js +2 -3
  129. package/lib/SyntheticEvent.js +97 -17
  130. package/lib/SyntheticFocusEvent.js +2 -3
  131. package/lib/SyntheticInputEvent.js +2 -3
  132. package/lib/SyntheticKeyboardEvent.js +2 -3
  133. package/lib/SyntheticMouseEvent.js +2 -3
  134. package/lib/SyntheticTouchEvent.js +2 -3
  135. package/lib/SyntheticTransitionEvent.js +39 -0
  136. package/lib/SyntheticUIEvent.js +2 -3
  137. package/lib/SyntheticWheelEvent.js +2 -3
  138. package/lib/TapEventPlugin.js +3 -12
  139. package/lib/Transaction.js +3 -3
  140. package/lib/ViewportMetrics.js +1 -1
  141. package/lib/accumulate.js +2 -2
  142. package/lib/accumulateInto.js +2 -2
  143. package/lib/adler32.js +3 -2
  144. package/lib/canDefineProperty.js +1 -1
  145. package/lib/createHierarchyRenderer.js +1 -1
  146. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  147. package/lib/dangerousStyleValue.js +25 -3
  148. package/lib/deprecated.js +4 -2
  149. package/lib/escapeTextContentForBrowser.js +1 -1
  150. package/lib/findDOMNode.js +15 -8
  151. package/lib/flattenChildren.js +2 -2
  152. package/lib/forEachAccumulated.js +2 -1
  153. package/lib/getEventCharCode.js +2 -2
  154. package/lib/getEventKey.js +1 -2
  155. package/lib/getEventModifierState.js +1 -2
  156. package/lib/getEventTarget.js +8 -2
  157. package/lib/getIteratorFn.js +2 -2
  158. package/lib/getNativeComponentFromComposite.js +30 -0
  159. package/lib/getNodeForCharacterOffset.js +2 -1
  160. package/lib/getTestDocument.js +1 -1
  161. package/lib/getTextContentAccessor.js +1 -1
  162. package/lib/getVendorPrefixedEventName.js +101 -0
  163. package/lib/instantiateReactComponent.js +9 -11
  164. package/lib/isEventSupported.js +2 -2
  165. package/lib/isTextInputElement.js +2 -1
  166. package/lib/onlyChild.js +2 -2
  167. package/lib/quoteAttributeValueForBrowser.js +1 -1
  168. package/lib/reactComponentExpect.js +2 -2
  169. package/lib/renderSubtreeIntoContainer.js +1 -1
  170. package/lib/setInnerHTML.js +5 -14
  171. package/lib/setTextContent.js +1 -1
  172. package/lib/shallowCompare.js +1 -1
  173. package/lib/shouldUpdateReactComponent.js +2 -3
  174. package/lib/sliceChildren.js +1 -1
  175. package/lib/traverseAllChildren.js +8 -8
  176. package/lib/update.js +12 -12
  177. package/lib/validateDOMNesting.js +15 -11
  178. package/package.json +2 -2
  179. package/lib/ReactBrowserComponentMixin.js +0 -36
  180. package/lib/ReactEmptyComponentRegistry.js +0 -48
  181. package/lib/ReactRootIndex.js +0 -29
  182. package/lib/ServerReactRootIndex.js +0 -29
  183. package/lib/cloneWithProps.js +0 -54
  184. package/lib/webcomponents.js +0 -6379
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2014-2015, Facebook, Inc.
2
+ * Copyright 2014-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,39 +7,25 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactServerRenderingTransaction
10
- * @typechecks
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
14
  var PooledClass = require('./PooledClass');
16
- var CallbackQueue = require('./CallbackQueue');
17
15
  var Transaction = require('./Transaction');
18
16
 
19
17
  var assign = require('./Object.assign');
20
- var emptyFunction = require('fbjs/lib/emptyFunction');
21
-
22
- /**
23
- * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
24
- * during the performing of the transaction.
25
- */
26
- var ON_DOM_READY_QUEUEING = {
27
- /**
28
- * Initializes the internal `onDOMReady` queue.
29
- */
30
- initialize: function () {
31
- this.reactMountReady.reset();
32
- },
33
-
34
- close: emptyFunction
35
- };
36
18
 
37
19
  /**
38
20
  * Executed within the scope of the `Transaction` instance. Consider these as
39
21
  * being member methods, but with an implied ordering while being isolated from
40
22
  * each other.
41
23
  */
42
- var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
24
+ var TRANSACTION_WRAPPERS = [];
25
+
26
+ var noopCallbackQueue = {
27
+ enqueue: function () {}
28
+ };
43
29
 
44
30
  /**
45
31
  * @class ReactServerRenderingTransaction
@@ -48,7 +34,6 @@ var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
48
34
  function ReactServerRenderingTransaction(renderToStaticMarkup) {
49
35
  this.reinitializeTransaction();
50
36
  this.renderToStaticMarkup = renderToStaticMarkup;
51
- this.reactMountReady = CallbackQueue.getPooled(null);
52
37
  this.useCreateElement = false;
53
38
  }
54
39
 
@@ -67,17 +52,14 @@ var Mixin = {
67
52
  * @return {object} The queue to collect `onDOMReady` callbacks with.
68
53
  */
69
54
  getReactMountReady: function () {
70
- return this.reactMountReady;
55
+ return noopCallbackQueue;
71
56
  },
72
57
 
73
58
  /**
74
59
  * `PooledClass` looks for this, and will invoke this before allowing this
75
60
  * instance to be reused.
76
61
  */
77
- destructor: function () {
78
- CallbackQueue.release(this.reactMountReady);
79
- this.reactMountReady = null;
80
- }
62
+ destructor: function () {}
81
63
  };
82
64
 
83
65
  assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright 2014-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule ReactSimpleEmptyComponent
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactReconciler = require('./ReactReconciler');
15
+
16
+ var assign = require('./Object.assign');
17
+
18
+ var ReactSimpleEmptyComponent = function (placeholderElement, instantiate) {
19
+ this._currentElement = null;
20
+ this._renderedComponent = instantiate(placeholderElement);
21
+ };
22
+ assign(ReactSimpleEmptyComponent.prototype, {
23
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
24
+ return ReactReconciler.mountComponent(this._renderedComponent, transaction, nativeParent, nativeContainerInfo, context);
25
+ },
26
+ receiveComponent: function () {},
27
+ getNativeNode: function () {
28
+ return ReactReconciler.getNativeNode(this._renderedComponent);
29
+ },
30
+ unmountComponent: function () {
31
+ ReactReconciler.unmountComponent(this._renderedComponent);
32
+ this._renderedComponent = null;
33
+ }
34
+ });
35
+
36
+ module.exports = ReactSimpleEmptyComponent;
@@ -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
@@ -13,15 +13,15 @@
13
13
 
14
14
  var EventConstants = require('./EventConstants');
15
15
  var EventPluginHub = require('./EventPluginHub');
16
+ var EventPluginRegistry = require('./EventPluginRegistry');
16
17
  var EventPropagators = require('./EventPropagators');
17
18
  var React = require('./React');
18
19
  var ReactDOM = require('./ReactDOM');
20
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
19
21
  var ReactElement = require('./ReactElement');
20
22
  var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
21
23
  var ReactCompositeComponent = require('./ReactCompositeComponent');
22
- var ReactInstanceHandles = require('./ReactInstanceHandles');
23
24
  var ReactInstanceMap = require('./ReactInstanceMap');
24
- var ReactMount = require('./ReactMount');
25
25
  var ReactUpdates = require('./ReactUpdates');
26
26
  var SyntheticEvent = require('./SyntheticEvent');
27
27
 
@@ -140,7 +140,7 @@ var ReactTestUtils = {
140
140
  if (!inst) {
141
141
  return [];
142
142
  }
143
- !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
143
+ !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : void 0;
144
144
  return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
145
145
  },
146
146
 
@@ -178,7 +178,7 @@ var ReactTestUtils = {
178
178
  findRenderedDOMComponentWithClass: function (root, className) {
179
179
  var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
180
180
  if (all.length !== 1) {
181
- throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
181
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
182
182
  }
183
183
  return all[0];
184
184
  },
@@ -203,7 +203,7 @@ var ReactTestUtils = {
203
203
  findRenderedDOMComponentWithTag: function (root, tagName) {
204
204
  var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
205
205
  if (all.length !== 1) {
206
- throw new Error('Did not find exactly one match for tag:' + tagName);
206
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
207
207
  }
208
208
  return all[0];
209
209
  },
@@ -227,7 +227,7 @@ var ReactTestUtils = {
227
227
  findRenderedComponentWithType: function (root, componentType) {
228
228
  var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
229
229
  if (all.length !== 1) {
230
- throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
230
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
231
231
  }
232
232
  return all[0];
233
233
  },
@@ -299,8 +299,8 @@ var ReactShallowRenderer = function () {
299
299
  this._instance = null;
300
300
  };
301
301
 
302
- ReactShallowRenderer.prototype.getRenderOutput = function () {
303
- return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
302
+ ReactShallowRenderer.prototype.getMountedInstance = function () {
303
+ return this._instance ? this._instance._instance : null;
304
304
  };
305
305
 
306
306
  var NoopInternalComponent = function (element) {
@@ -317,6 +317,10 @@ NoopInternalComponent.prototype = {
317
317
  this._currentElement = element;
318
318
  },
319
319
 
320
+ getNativeNode: function () {
321
+ return undefined;
322
+ },
323
+
320
324
  unmountComponent: function () {},
321
325
 
322
326
  getPublicInstance: function () {
@@ -324,34 +328,42 @@ NoopInternalComponent.prototype = {
324
328
  }
325
329
  };
326
330
 
327
- var ShallowComponentWrapper = function () {};
331
+ var ShallowComponentWrapper = function (element) {
332
+ this.construct(element);
333
+ };
328
334
  assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
329
335
  _instantiateReactComponent: function (element) {
330
336
  return new NoopInternalComponent(element);
331
337
  },
332
- _replaceNodeWithMarkupByID: function () {},
338
+ _replaceNodeWithMarkup: function () {},
333
339
  _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
334
340
  });
335
341
 
336
342
  ReactShallowRenderer.prototype.render = function (element, context) {
337
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : undefined;
338
- !(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : undefined;
343
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : void 0;
344
+ !(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : void 0;
339
345
 
340
346
  if (!context) {
341
347
  context = emptyObject;
342
348
  }
343
349
  ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
350
+
351
+ return this.getRenderOutput();
344
352
  };
345
353
 
346
354
  function _batchedRender(renderer, element, context) {
347
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
355
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
348
356
  renderer._render(element, transaction, context);
349
357
  ReactUpdates.ReactReconcileTransaction.release(transaction);
350
358
  }
351
359
 
360
+ ReactShallowRenderer.prototype.getRenderOutput = function () {
361
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
362
+ };
363
+
352
364
  ReactShallowRenderer.prototype.unmount = function () {
353
365
  if (this._instance) {
354
- this._instance.unmountComponent();
366
+ this._instance.unmountComponent(false);
355
367
  }
356
368
  };
357
369
 
@@ -359,12 +371,8 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
359
371
  if (this._instance) {
360
372
  this._instance.receiveComponent(element, transaction, context);
361
373
  } else {
362
- var rootID = ReactInstanceHandles.createReactRootID();
363
- var instance = new ShallowComponentWrapper(element.type);
364
- instance.construct(element);
365
-
366
- instance.mountComponent(rootID, transaction, context);
367
-
374
+ var instance = new ShallowComponentWrapper(element);
375
+ instance.mountComponent(transaction, null, null, context);
368
376
  this._instance = instance;
369
377
  }
370
378
  };
@@ -380,19 +388,20 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
380
388
  function makeSimulator(eventType) {
381
389
  return function (domComponentOrNode, eventData) {
382
390
  var node;
391
+ !!React.isValidElement(domComponentOrNode) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.' + 'TestUtils.Simulate will not work if you are using shallow rendering.') : invariant(false) : void 0;
383
392
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
384
393
  node = findDOMNode(domComponentOrNode);
385
394
  } else if (domComponentOrNode.tagName) {
386
395
  node = domComponentOrNode;
387
396
  }
388
397
 
389
- var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
398
+ var dispatchConfig = EventPluginRegistry.eventNameDispatchConfigs[eventType];
390
399
 
391
400
  var fakeNativeEvent = new Event();
392
401
  fakeNativeEvent.target = node;
393
402
  // We don't use SyntheticEvent.getPooled in order to not have to worry about
394
403
  // properly destroying any properties assigned from `eventData` upon release
395
- var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
404
+ var event = new SyntheticEvent(dispatchConfig, ReactDOMComponentTree.getInstanceFromNode(node), fakeNativeEvent, node);
396
405
  assign(event, eventData);
397
406
 
398
407
  if (dispatchConfig.phasedRegistrationNames) {
@@ -412,7 +421,7 @@ function buildSimulators() {
412
421
  ReactTestUtils.Simulate = {};
413
422
 
414
423
  var eventType;
415
- for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
424
+ for (eventType in EventPluginRegistry.eventNameDispatchConfigs) {
416
425
  /**
417
426
  * @param {!Element|ReactDOMComponent} domComponentOrNode
418
427
  * @param {?object} eventData Fake event data to use in SyntheticEvent.
@@ -1,12 +1,11 @@
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
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
- * @typechecks static-only
10
9
  * @providesModule ReactTransitionChildMapping
11
10
  */
12
11
 
@@ -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
@@ -13,56 +13,20 @@
13
13
 
14
14
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15
15
 
16
- /**
17
- * EVENT_NAME_MAP is used to determine which event fired when a
18
- * transition/animation ends, based on the style property used to
19
- * define that event.
20
- */
21
- var EVENT_NAME_MAP = {
22
- transitionend: {
23
- 'transition': 'transitionend',
24
- 'WebkitTransition': 'webkitTransitionEnd',
25
- 'MozTransition': 'mozTransitionEnd',
26
- 'OTransition': 'oTransitionEnd',
27
- 'msTransition': 'MSTransitionEnd'
28
- },
29
-
30
- animationend: {
31
- 'animation': 'animationend',
32
- 'WebkitAnimation': 'webkitAnimationEnd',
33
- 'MozAnimation': 'mozAnimationEnd',
34
- 'OAnimation': 'oAnimationEnd',
35
- 'msAnimation': 'MSAnimationEnd'
36
- }
37
- };
16
+ var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
38
17
 
39
18
  var endEvents = [];
40
19
 
41
20
  function detectEvents() {
42
- var testEl = document.createElement('div');
43
- var style = testEl.style;
44
-
45
- // On some platforms, in particular some releases of Android 4.x,
46
- // the un-prefixed "animation" and "transition" properties are defined on the
47
- // style object but the events that fire will still be prefixed, so we need
48
- // to check if the un-prefixed events are useable, and if not remove them
49
- // from the map
50
- if (!('AnimationEvent' in window)) {
51
- delete EVENT_NAME_MAP.animationend.animation;
52
- }
21
+ var animEnd = getVendorPrefixedEventName('animationend');
22
+ var transEnd = getVendorPrefixedEventName('transitionend');
53
23
 
54
- if (!('TransitionEvent' in window)) {
55
- delete EVENT_NAME_MAP.transitionend.transition;
24
+ if (animEnd) {
25
+ endEvents.push(animEnd);
56
26
  }
57
27
 
58
- for (var baseEventName in EVENT_NAME_MAP) {
59
- var baseEvents = EVENT_NAME_MAP[baseEventName];
60
- for (var styleName in baseEvents) {
61
- if (styleName in style) {
62
- endEvents.push(baseEvents[styleName]);
63
- break;
64
- }
65
- }
28
+ if (transEnd) {
29
+ endEvents.push(transEnd);
66
30
  }
67
31
  }
68
32
 
@@ -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 2015, Facebook, Inc.
2
+ * Copyright 2015-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
@@ -12,11 +12,9 @@
12
12
  'use strict';
13
13
 
14
14
  var ReactCurrentOwner = require('./ReactCurrentOwner');
15
- var ReactElement = require('./ReactElement');
16
15
  var ReactInstanceMap = require('./ReactInstanceMap');
17
16
  var ReactUpdates = require('./ReactUpdates');
18
17
 
19
- var assign = require('./Object.assign');
20
18
  var invariant = require('fbjs/lib/invariant');
21
19
  var warning = require('fbjs/lib/warning');
22
20
 
@@ -31,13 +29,13 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
31
29
  // Only warn when we have a callerName. Otherwise we should be silent.
32
30
  // We're probably calling from enqueueCallback. We don't want to warn
33
31
  // there because we already warned for the corresponding lifecycle method.
34
- process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
32
+ process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : void 0;
35
33
  }
36
34
  return null;
37
35
  }
38
36
 
39
37
  if (process.env.NODE_ENV !== 'production') {
40
- process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
38
+ process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
41
39
  }
42
40
 
43
41
  return internalInstance;
@@ -60,7 +58,7 @@ var ReactUpdateQueue = {
60
58
  if (process.env.NODE_ENV !== 'production') {
61
59
  var owner = ReactCurrentOwner.current;
62
60
  if (owner !== null) {
63
- process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
61
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
64
62
  owner._warnedAboutRefsInRender = true;
65
63
  }
66
64
  }
@@ -84,7 +82,7 @@ var ReactUpdateQueue = {
84
82
  * @internal
85
83
  */
86
84
  enqueueCallback: function (publicInstance, callback) {
87
- !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
85
+ !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback of type ' + '%s. A function is expected', typeof callback === 'object' && Object.keys(callback).length && Object.keys(callback).length < 20 ? typeof callback + ' (keys: ' + Object.keys(callback) + ')' : typeof callback) : invariant(false) : void 0;
88
86
  var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
89
87
 
90
88
  // Previously we would throw an error if we didn't have an internal
@@ -109,7 +107,7 @@ var ReactUpdateQueue = {
109
107
  },
110
108
 
111
109
  enqueueCallbackInternal: function (internalInstance, callback) {
112
- !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
110
+ !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback of type ' + '%s. A function is expected', typeof callback === 'object' && Object.keys(callback).length && Object.keys(callback).length < 20 ? typeof callback + ' (keys: ' + Object.keys(callback) + ')' : typeof callback) : invariant(false) : void 0;
113
111
  if (internalInstance._pendingCallbacks) {
114
112
  internalInstance._pendingCallbacks.push(callback);
115
113
  } else {
@@ -190,63 +188,6 @@ var ReactUpdateQueue = {
190
188
  enqueueUpdate(internalInstance);
191
189
  },
192
190
 
193
- /**
194
- * Sets a subset of the props.
195
- *
196
- * @param {ReactClass} publicInstance The instance that should rerender.
197
- * @param {object} partialProps Subset of the next props.
198
- * @internal
199
- */
200
- enqueueSetProps: function (publicInstance, partialProps) {
201
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
202
- if (!internalInstance) {
203
- return;
204
- }
205
- ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
206
- },
207
-
208
- enqueueSetPropsInternal: function (internalInstance, partialProps) {
209
- var topLevelWrapper = internalInstance._topLevelWrapper;
210
- !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
211
-
212
- // Merge with the pending element if it exists, otherwise with existing
213
- // element props.
214
- var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
215
- var element = wrapElement.props;
216
- var props = assign({}, element.props, partialProps);
217
- topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
218
-
219
- enqueueUpdate(topLevelWrapper);
220
- },
221
-
222
- /**
223
- * Replaces all of the props.
224
- *
225
- * @param {ReactClass} publicInstance The instance that should rerender.
226
- * @param {object} props New props.
227
- * @internal
228
- */
229
- enqueueReplaceProps: function (publicInstance, props) {
230
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
231
- if (!internalInstance) {
232
- return;
233
- }
234
- ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
235
- },
236
-
237
- enqueueReplacePropsInternal: function (internalInstance, props) {
238
- var topLevelWrapper = internalInstance._topLevelWrapper;
239
- !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
240
-
241
- // Merge with the pending element if it exists, otherwise with existing
242
- // element props.
243
- var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
244
- var element = wrapElement.props;
245
- topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
246
-
247
- enqueueUpdate(topLevelWrapper);
248
- },
249
-
250
191
  enqueueElementInternal: function (internalInstance, newElement) {
251
192
  internalInstance._pendingElement = newElement;
252
193
  enqueueUpdate(internalInstance);