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
package/lib/ReactRef.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
@@ -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,7 +7,6 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactServerBatchingStrategy
10
- * @typechecks
11
10
  */
12
11
 
13
12
  'use strict';
@@ -1,19 +1,18 @@
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 ReactServerRendering
11
10
  */
12
11
  'use strict';
13
12
 
13
+ var ReactDOMContainerInfo = require('./ReactDOMContainerInfo');
14
14
  var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
15
15
  var ReactElement = require('./ReactElement');
16
- var ReactInstanceHandles = require('./ReactInstanceHandles');
17
16
  var ReactMarkupChecksum = require('./ReactMarkupChecksum');
18
17
  var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
19
18
  var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
@@ -27,20 +26,20 @@ var invariant = require('fbjs/lib/invariant');
27
26
  * @param {ReactElement} element
28
27
  * @return {string} the HTML markup
29
28
  */
30
- function renderToString(element) {
31
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
32
-
29
+ function renderToStringImpl(element, makeStaticMarkup) {
33
30
  var transaction;
34
31
  try {
35
32
  ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
36
33
 
37
- var id = ReactInstanceHandles.createReactRootID();
38
- transaction = ReactServerRenderingTransaction.getPooled(false);
34
+ transaction = ReactServerRenderingTransaction.getPooled(makeStaticMarkup);
39
35
 
40
36
  return transaction.perform(function () {
41
- var componentInstance = instantiateReactComponent(element, null);
42
- var markup = componentInstance.mountComponent(id, transaction, emptyObject);
43
- return ReactMarkupChecksum.addChecksumToMarkup(markup);
37
+ var componentInstance = instantiateReactComponent(element);
38
+ var markup = componentInstance.mountComponent(transaction, null, ReactDOMContainerInfo(), emptyObject);
39
+ if (!makeStaticMarkup) {
40
+ markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
41
+ }
42
+ return markup;
44
43
  }, null);
45
44
  } finally {
46
45
  ReactServerRenderingTransaction.release(transaction);
@@ -50,31 +49,14 @@ function renderToString(element) {
50
49
  }
51
50
  }
52
51
 
53
- /**
54
- * @param {ReactElement} element
55
- * @return {string} the HTML markup, without the extra React ID and checksum
56
- * (for generating static pages)
57
- */
58
- function renderToStaticMarkup(element) {
59
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
60
-
61
- var transaction;
62
- try {
63
- ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
64
-
65
- var id = ReactInstanceHandles.createReactRootID();
66
- transaction = ReactServerRenderingTransaction.getPooled(true);
52
+ function renderToString(element) {
53
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : void 0;
54
+ return renderToStringImpl(element, false);
55
+ }
67
56
 
68
- return transaction.perform(function () {
69
- var componentInstance = instantiateReactComponent(element, null);
70
- return componentInstance.mountComponent(id, transaction, emptyObject);
71
- }, null);
72
- } finally {
73
- ReactServerRenderingTransaction.release(transaction);
74
- // Revert to the DOM batching strategy since these two renderers
75
- // currently share these stateful modules.
76
- ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
77
- }
57
+ function renderToStaticMarkup(element) {
58
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : void 0;
59
+ return renderToStringImpl(element, true);
78
60
  }
79
61
 
80
62
  module.exports = {
@@ -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
 
14
+ var _assign = require('object-assign');
15
+
15
16
  var PooledClass = require('./PooledClass');
16
- var CallbackQueue = require('./CallbackQueue');
17
17
  var Transaction = require('./Transaction');
18
18
 
19
- 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
-
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,20 +52,17 @@ 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
- assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
65
+ _assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
84
66
 
85
67
  PooledClass.addPoolingTo(ReactServerRenderingTransaction);
86
68
 
@@ -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 _assign = require('object-assign');
15
+
16
+ var ReactReconciler = require('./ReactReconciler');
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
@@ -11,21 +11,23 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _assign = require('object-assign');
15
+
14
16
  var EventConstants = require('./EventConstants');
15
17
  var EventPluginHub = require('./EventPluginHub');
18
+ var EventPluginRegistry = require('./EventPluginRegistry');
16
19
  var EventPropagators = require('./EventPropagators');
17
20
  var React = require('./React');
21
+ var ReactDefaultInjection = require('./ReactDefaultInjection');
18
22
  var ReactDOM = require('./ReactDOM');
23
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
19
24
  var ReactElement = require('./ReactElement');
20
25
  var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
21
26
  var ReactCompositeComponent = require('./ReactCompositeComponent');
22
- var ReactInstanceHandles = require('./ReactInstanceHandles');
23
27
  var ReactInstanceMap = require('./ReactInstanceMap');
24
- var ReactMount = require('./ReactMount');
25
28
  var ReactUpdates = require('./ReactUpdates');
26
29
  var SyntheticEvent = require('./SyntheticEvent');
27
30
 
28
- var assign = require('./Object.assign');
29
31
  var emptyObject = require('fbjs/lib/emptyObject');
30
32
  var findDOMNode = require('./findDOMNode');
31
33
  var invariant = require('fbjs/lib/invariant');
@@ -140,7 +142,7 @@ var ReactTestUtils = {
140
142
  if (!inst) {
141
143
  return [];
142
144
  }
143
- !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
145
+ !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : void 0;
144
146
  return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
145
147
  },
146
148
 
@@ -178,7 +180,7 @@ var ReactTestUtils = {
178
180
  findRenderedDOMComponentWithClass: function (root, className) {
179
181
  var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
180
182
  if (all.length !== 1) {
181
- throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
183
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
182
184
  }
183
185
  return all[0];
184
186
  },
@@ -203,7 +205,7 @@ var ReactTestUtils = {
203
205
  findRenderedDOMComponentWithTag: function (root, tagName) {
204
206
  var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
205
207
  if (all.length !== 1) {
206
- throw new Error('Did not find exactly one match for tag:' + tagName);
208
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
207
209
  }
208
210
  return all[0];
209
211
  },
@@ -227,7 +229,7 @@ var ReactTestUtils = {
227
229
  findRenderedComponentWithType: function (root, componentType) {
228
230
  var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
229
231
  if (all.length !== 1) {
230
- throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
232
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
231
233
  }
232
234
  return all[0];
233
235
  },
@@ -299,8 +301,8 @@ var ReactShallowRenderer = function () {
299
301
  this._instance = null;
300
302
  };
301
303
 
302
- ReactShallowRenderer.prototype.getRenderOutput = function () {
303
- return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
304
+ ReactShallowRenderer.prototype.getMountedInstance = function () {
305
+ return this._instance ? this._instance._instance : null;
304
306
  };
305
307
 
306
308
  var NoopInternalComponent = function (element) {
@@ -317,6 +319,10 @@ NoopInternalComponent.prototype = {
317
319
  this._currentElement = element;
318
320
  },
319
321
 
322
+ getNativeNode: function () {
323
+ return undefined;
324
+ },
325
+
320
326
  unmountComponent: function () {},
321
327
 
322
328
  getPublicInstance: function () {
@@ -324,34 +330,47 @@ NoopInternalComponent.prototype = {
324
330
  }
325
331
  };
326
332
 
327
- var ShallowComponentWrapper = function () {};
328
- assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
333
+ var ShallowComponentWrapper = function (element) {
334
+ this.construct(element);
335
+ };
336
+ _assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
329
337
  _instantiateReactComponent: function (element) {
330
338
  return new NoopInternalComponent(element);
331
339
  },
332
- _replaceNodeWithMarkupByID: function () {},
340
+ _replaceNodeWithMarkup: function () {},
333
341
  _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
334
342
  });
335
343
 
336
344
  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;
345
+ // Ensure we've done the default injections. This might not be true in the
346
+ // case of a simple test that only requires React and the TestUtils in
347
+ // conjunction with an inline-requires transform.
348
+ ReactDefaultInjection.inject();
349
+
350
+ !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;
351
+ !(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
352
 
340
353
  if (!context) {
341
354
  context = emptyObject;
342
355
  }
343
356
  ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
357
+
358
+ return this.getRenderOutput();
344
359
  };
345
360
 
346
361
  function _batchedRender(renderer, element, context) {
347
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
362
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
348
363
  renderer._render(element, transaction, context);
349
364
  ReactUpdates.ReactReconcileTransaction.release(transaction);
350
365
  }
351
366
 
367
+ ReactShallowRenderer.prototype.getRenderOutput = function () {
368
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
369
+ };
370
+
352
371
  ReactShallowRenderer.prototype.unmount = function () {
353
372
  if (this._instance) {
354
- this._instance.unmountComponent();
373
+ this._instance.unmountComponent(false);
355
374
  }
356
375
  };
357
376
 
@@ -359,12 +378,8 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
359
378
  if (this._instance) {
360
379
  this._instance.receiveComponent(element, transaction, context);
361
380
  } 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
-
381
+ var instance = new ShallowComponentWrapper(element);
382
+ instance.mountComponent(transaction, null, null, context);
368
383
  this._instance = instance;
369
384
  }
370
385
  };
@@ -380,20 +395,24 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
380
395
  function makeSimulator(eventType) {
381
396
  return function (domComponentOrNode, eventData) {
382
397
  var node;
398
+ !!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
399
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
384
400
  node = findDOMNode(domComponentOrNode);
385
401
  } else if (domComponentOrNode.tagName) {
386
402
  node = domComponentOrNode;
387
403
  }
388
404
 
389
- var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
405
+ var dispatchConfig = EventPluginRegistry.eventNameDispatchConfigs[eventType];
390
406
 
391
407
  var fakeNativeEvent = new Event();
392
408
  fakeNativeEvent.target = node;
393
409
  // We don't use SyntheticEvent.getPooled in order to not have to worry about
394
410
  // properly destroying any properties assigned from `eventData` upon release
395
- var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
396
- assign(event, eventData);
411
+ var event = new SyntheticEvent(dispatchConfig, ReactDOMComponentTree.getInstanceFromNode(node), fakeNativeEvent, node);
412
+ // Since we aren't using pooling, always persist the event. This will make
413
+ // sure it's marked and won't warn when setting additional properties.
414
+ event.persist();
415
+ _assign(event, eventData);
397
416
 
398
417
  if (dispatchConfig.phasedRegistrationNames) {
399
418
  EventPropagators.accumulateTwoPhaseDispatches(event);
@@ -412,7 +431,7 @@ function buildSimulators() {
412
431
  ReactTestUtils.Simulate = {};
413
432
 
414
433
  var eventType;
415
- for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
434
+ for (eventType in EventPluginRegistry.eventNameDispatchConfigs) {
416
435
  /**
417
436
  * @param {!Element|ReactDOMComponent} domComponentOrNode
418
437
  * @param {?object} eventData Fake event data to use in SyntheticEvent.
@@ -454,7 +473,7 @@ buildSimulators();
454
473
  function makeNativeSimulator(eventType) {
455
474
  return function (domComponentOrNode, nativeEventData) {
456
475
  var fakeNativeEvent = new Event(eventType);
457
- assign(fakeNativeEvent, nativeEventData);
476
+ _assign(fakeNativeEvent, nativeEventData);
458
477
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
459
478
  ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
460
479
  } else if (domComponentOrNode.tagName) {
@@ -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