react 0.14.0-beta1 → 0.14.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 (173) hide show
  1. package/addons.js +8 -3
  2. package/dist/react-with-addons.js +5048 -4095
  3. package/dist/react-with-addons.min.js +6 -6
  4. package/dist/react.js +4555 -3729
  5. package/dist/react.min.js +6 -5
  6. package/lib/AutoFocusUtils.js +3 -3
  7. package/lib/BeforeInputEventPlugin.js +13 -13
  8. package/lib/CSSProperty.js +18 -3
  9. package/lib/CSSPropertyOperations.js +27 -14
  10. package/lib/CallbackQueue.js +4 -4
  11. package/lib/ChangeEventPlugin.js +15 -14
  12. package/lib/DOMChildrenOperations.js +22 -7
  13. package/lib/DOMProperty.js +8 -8
  14. package/lib/DOMPropertyOperations.js +23 -10
  15. package/lib/Danger.js +21 -16
  16. package/lib/DefaultEventPluginOrder.js +2 -2
  17. package/lib/EnterLeaveEventPlugin.js +18 -10
  18. package/lib/EventConstants.js +23 -1
  19. package/lib/EventPluginHub.js +29 -21
  20. package/lib/EventPluginRegistry.js +8 -8
  21. package/lib/EventPluginUtils.js +34 -38
  22. package/lib/EventPropagators.js +8 -8
  23. package/lib/FallbackCompositionState.js +9 -3
  24. package/lib/HTMLDOMPropertyConfig.js +24 -4
  25. package/lib/LinkedStateMixin.js +2 -2
  26. package/lib/LinkedValueUtils.js +8 -8
  27. package/lib/MetaMatchers.js +118 -0
  28. package/lib/OrderedMap.js +453 -0
  29. package/lib/PooledClass.js +3 -5
  30. package/lib/React.js +18 -7
  31. package/lib/ReactBrowserComponentMixin.js +4 -4
  32. package/lib/ReactBrowserEventEmitter.js +36 -7
  33. package/lib/ReactCSSTransitionGroup.js +35 -9
  34. package/lib/ReactCSSTransitionGroupChild.js +48 -30
  35. package/lib/ReactChildReconciler.js +24 -19
  36. package/lib/ReactChildren.js +72 -32
  37. package/lib/ReactClass.js +46 -46
  38. package/lib/ReactComponent.js +18 -16
  39. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  40. package/lib/ReactComponentEnvironment.js +2 -2
  41. package/lib/ReactComponentWithPureRenderMixin.js +1 -1
  42. package/lib/ReactCompositeComponent.js +95 -44
  43. package/lib/ReactDOM.js +74 -159
  44. package/lib/ReactDOMComponent.js +235 -93
  45. package/lib/ReactDOMFactories.js +177 -0
  46. package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
  47. package/lib/ReactDOMIDOperations.js +8 -81
  48. package/lib/ReactDOMInput.js +18 -9
  49. package/lib/ReactDOMOption.js +7 -7
  50. package/lib/ReactDOMSelect.js +9 -9
  51. package/lib/ReactDOMSelection.js +19 -3
  52. package/lib/ReactDOMServer.js +5 -3
  53. package/lib/ReactDOMTextComponent.js +33 -20
  54. package/lib/ReactDOMTextarea.js +14 -12
  55. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  56. package/lib/ReactDefaultInjection.js +23 -25
  57. package/lib/ReactDefaultPerf.js +17 -11
  58. package/lib/ReactDefaultPerfAnalysis.js +13 -12
  59. package/lib/ReactElement.js +85 -39
  60. package/lib/ReactElementValidator.js +47 -90
  61. package/lib/ReactEmptyComponent.js +26 -62
  62. package/lib/ReactEmptyComponentRegistry.js +48 -0
  63. package/lib/ReactErrorUtils.js +53 -9
  64. package/lib/ReactEventEmitterMixin.js +2 -2
  65. package/lib/ReactEventListener.js +33 -21
  66. package/lib/ReactFragment.js +27 -118
  67. package/lib/ReactInjection.js +10 -12
  68. package/lib/ReactInputSelection.js +4 -4
  69. package/lib/ReactInstanceHandles.js +10 -11
  70. package/lib/ReactIsomorphic.js +15 -11
  71. package/lib/ReactLink.js +2 -2
  72. package/lib/ReactMarkupChecksum.js +6 -2
  73. package/lib/ReactMount.js +186 -85
  74. package/lib/ReactMultiChild.js +119 -25
  75. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  76. package/lib/ReactNativeComponent.js +3 -3
  77. package/lib/ReactNoopUpdateQueue.js +3 -3
  78. package/lib/ReactOwner.js +3 -3
  79. package/lib/ReactPerf.js +2 -2
  80. package/lib/ReactPropTransferer.js +3 -3
  81. package/lib/ReactPropTypeLocationNames.js +1 -1
  82. package/lib/ReactPropTypeLocations.js +1 -1
  83. package/lib/ReactPropTypes.js +38 -9
  84. package/lib/ReactReconcileTransaction.js +10 -8
  85. package/lib/ReactReconciler.js +5 -6
  86. package/lib/ReactRef.js +14 -2
  87. package/lib/ReactServerBatchingStrategy.js +5 -5
  88. package/lib/ReactServerRendering.js +12 -12
  89. package/lib/ReactServerRenderingTransaction.js +6 -5
  90. package/lib/ReactTestUtils.js +47 -39
  91. package/lib/ReactTransitionChildMapping.js +3 -6
  92. package/lib/ReactTransitionEvents.js +1 -1
  93. package/lib/ReactTransitionGroup.js +5 -6
  94. package/lib/ReactUpdateQueue.js +19 -19
  95. package/lib/ReactUpdates.js +15 -15
  96. package/lib/{performance.js → ReactVersion.js} +3 -12
  97. package/lib/ReactWithAddons.js +24 -15
  98. package/lib/ResponderEventPlugin.js +514 -0
  99. package/lib/ResponderSyntheticEvent.js +40 -0
  100. package/lib/ResponderTouchHistoryStore.js +180 -0
  101. package/lib/SVGDOMPropertyConfig.js +1 -1
  102. package/lib/SelectEventPlugin.js +19 -9
  103. package/lib/SimpleEventPlugin.js +198 -43
  104. package/lib/SyntheticClipboardEvent.js +1 -1
  105. package/lib/SyntheticCompositionEvent.js +1 -1
  106. package/lib/SyntheticDragEvent.js +1 -1
  107. package/lib/SyntheticEvent.js +18 -4
  108. package/lib/SyntheticFocusEvent.js +1 -1
  109. package/lib/SyntheticInputEvent.js +1 -1
  110. package/lib/SyntheticKeyboardEvent.js +4 -4
  111. package/lib/SyntheticMouseEvent.js +3 -3
  112. package/lib/SyntheticTouchEvent.js +2 -2
  113. package/lib/SyntheticUIEvent.js +2 -2
  114. package/lib/SyntheticWheelEvent.js +1 -1
  115. package/lib/TapEventPlugin.js +119 -0
  116. package/lib/Transaction.js +7 -7
  117. package/lib/accumulate.js +44 -0
  118. package/lib/accumulateInto.js +2 -2
  119. package/lib/adler32.js +19 -7
  120. package/lib/cloneWithProps.js +11 -6
  121. package/lib/createHierarchyRenderer.js +85 -0
  122. package/lib/dangerousStyleValue.js +1 -1
  123. package/lib/deprecated.js +7 -6
  124. package/lib/findDOMNode.js +9 -9
  125. package/lib/flattenChildren.js +4 -4
  126. package/lib/getEventKey.js +1 -1
  127. package/lib/{isTextNode.js → getTestDocument.js} +7 -11
  128. package/lib/getTextContentAccessor.js +1 -1
  129. package/lib/instantiateReactComponent.js +15 -17
  130. package/lib/isEventSupported.js +1 -1
  131. package/lib/onlyChild.js +3 -3
  132. package/lib/quoteAttributeValueForBrowser.js +1 -1
  133. package/lib/reactComponentExpect.js +216 -0
  134. package/lib/renderSubtreeIntoContainer.js +1 -1
  135. package/lib/setInnerHTML.js +1 -1
  136. package/lib/setTextContent.js +3 -3
  137. package/lib/shallowCompare.js +1 -1
  138. package/lib/shouldUpdateReactComponent.js +12 -8
  139. package/lib/sliceChildren.js +34 -0
  140. package/lib/traverseAllChildren.js +25 -18
  141. package/lib/update.js +13 -13
  142. package/lib/validateDOMNesting.js +6 -6
  143. package/lib/webcomponents.js +6379 -0
  144. package/package.json +4 -6
  145. package/react.js +1 -51
  146. package/dist/JSXTransformer.js +0 -17588
  147. package/lib/CSSCore.js +0 -97
  148. package/lib/EventListener.js +0 -84
  149. package/lib/ExecutionEnvironment.js +0 -38
  150. package/lib/ReactDOMClient.js +0 -90
  151. package/lib/camelize.js +0 -32
  152. package/lib/camelizeStyleName.js +0 -40
  153. package/lib/containsNode.js +0 -55
  154. package/lib/createArrayFromMixed.js +0 -85
  155. package/lib/createNodesFromMarkup.js +0 -84
  156. package/lib/emptyFunction.js +0 -38
  157. package/lib/focusNode.js +0 -26
  158. package/lib/getActiveElement.js +0 -29
  159. package/lib/getMarkupWrap.js +0 -93
  160. package/lib/getUnboundedScrollPosition.js +0 -38
  161. package/lib/hyphenate.js +0 -33
  162. package/lib/hyphenateStyleName.js +0 -39
  163. package/lib/invariant.js +0 -49
  164. package/lib/isNode.js +0 -23
  165. package/lib/joinClasses.js +0 -39
  166. package/lib/keyMirror.js +0 -48
  167. package/lib/keyOf.js +0 -35
  168. package/lib/mapObject.js +0 -51
  169. package/lib/memoizeStringOnly.js +0 -31
  170. package/lib/performanceNow.js +0 -28
  171. package/lib/shallowEqual.js +0 -48
  172. package/lib/toArray.js +0 -57
  173. package/lib/warning.js +0 -57
@@ -12,13 +12,14 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var CallbackQueue = require("./CallbackQueue");
16
- var PooledClass = require("./PooledClass");
17
- var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
18
- var ReactInputSelection = require("./ReactInputSelection");
19
- var Transaction = require("./Transaction");
15
+ var CallbackQueue = require('./CallbackQueue');
16
+ var PooledClass = require('./PooledClass');
17
+ var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
18
+ var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
19
+ var ReactInputSelection = require('./ReactInputSelection');
20
+ var Transaction = require('./Transaction');
20
21
 
21
- var assign = require("./Object.assign");
22
+ var assign = require('./Object.assign');
22
23
 
23
24
  /**
24
25
  * Ensures that, when possible, the selection range (currently selected text
@@ -53,7 +54,7 @@ var EVENT_SUPPRESSION = {
53
54
 
54
55
  /**
55
56
  * @param {boolean} previouslyEnabled Enabled status of
56
- * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
57
+ * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
57
58
  * restores the previous value.
58
59
  */
59
60
  close: function (previouslyEnabled) {
@@ -102,7 +103,7 @@ var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_REA
102
103
  *
103
104
  * @class ReactReconcileTransaction
104
105
  */
105
- function ReactReconcileTransaction() {
106
+ function ReactReconcileTransaction(forceHTML) {
106
107
  this.reinitializeTransaction();
107
108
  // Only server-side rendering really needs this option (see
108
109
  // `ReactServerRendering`), but server-side uses
@@ -111,6 +112,7 @@ function ReactReconcileTransaction() {
111
112
  // `ReactTextComponent` checks it in `mountComponent`.`
112
113
  this.renderToStaticMarkup = false;
113
114
  this.reactMountReady = CallbackQueue.getPooled(null);
115
+ this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
114
116
  }
115
117
 
116
118
  var Mixin = {
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactRef = require("./ReactRef");
14
+ var ReactRef = require('./ReactRef');
15
15
 
16
16
  /**
17
17
  * Helper to call ReactRef.attachRefs with this composite component, split out
@@ -35,7 +35,7 @@ var ReactReconciler = {
35
35
  */
36
36
  mountComponent: function (internalInstance, rootID, transaction, context) {
37
37
  var markup = internalInstance.mountComponent(rootID, transaction, context);
38
- if (internalInstance._currentElement.ref != null) {
38
+ if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
39
39
  transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
40
40
  }
41
41
  return markup;
@@ -63,9 +63,8 @@ var ReactReconciler = {
63
63
  */
64
64
  receiveComponent: function (internalInstance, nextElement, transaction, context) {
65
65
  var prevElement = internalInstance._currentElement;
66
- if (nextElement === prevElement && nextElement._owner != null
67
- // TODO: Shouldn't we need to do this: `&& context === internalInstance._context`
68
- ) {
66
+
67
+ if (nextElement === prevElement && context === internalInstance._context) {
69
68
  // Since elements are immutable after the owner is rendered,
70
69
  // we can do a cheap identity compare here to determine if this is a
71
70
  // superfluous reconcile. It's possible for state to be mutable but such
@@ -87,7 +86,7 @@ var ReactReconciler = {
87
86
 
88
87
  internalInstance.receiveComponent(nextElement, transaction, context);
89
88
 
90
- if (refsChanged) {
89
+ if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
91
90
  transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
92
91
  }
93
92
  },
package/lib/ReactRef.js CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactOwner = require("./ReactOwner");
14
+ var ReactOwner = require('./ReactOwner');
15
15
 
16
16
  var ReactRef = {};
17
17
 
@@ -34,6 +34,9 @@ function detachRef(ref, component, owner) {
34
34
  }
35
35
 
36
36
  ReactRef.attachRefs = function (instance, element) {
37
+ if (element === null || element === false) {
38
+ return;
39
+ }
37
40
  var ref = element.ref;
38
41
  if (ref != null) {
39
42
  attachRef(ref, instance, element._owner);
@@ -53,10 +56,19 @@ ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
53
56
  // is made. It probably belongs where the key checking and
54
57
  // instantiateReactComponent is done.
55
58
 
56
- return nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref;
59
+ var prevEmpty = prevElement === null || prevElement === false;
60
+ var nextEmpty = nextElement === null || nextElement === false;
61
+
62
+ return(
63
+ // This has a few false positives w/r/t empty components.
64
+ prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
65
+ );
57
66
  };
58
67
 
59
68
  ReactRef.detachRefs = function (instance, element) {
69
+ if (element === null || element === false) {
70
+ return;
71
+ }
60
72
  var ref = element.ref;
61
73
  if (ref != null) {
62
74
  detachRef(ref, instance, element._owner);
@@ -14,10 +14,10 @@
14
14
 
15
15
  var ReactServerBatchingStrategy = {
16
16
  isBatchingUpdates: false,
17
- batchedUpdates: function (callback) {}
17
+ batchedUpdates: function (callback) {
18
+ // Don't do anything here. During the server rendering we don't want to
19
+ // schedule any updates. We will simply ignore them.
20
+ }
18
21
  };
19
22
 
20
- module.exports = ReactServerBatchingStrategy;
21
-
22
- // Don't do anything here. During the server rendering we don't want to
23
- // schedule any updates. We will simply ignore them.
23
+ module.exports = ReactServerBatchingStrategy;
@@ -11,24 +11,24 @@
11
11
  */
12
12
  'use strict';
13
13
 
14
- var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
15
- var ReactElement = require("./ReactElement");
16
- var ReactInstanceHandles = require("./ReactInstanceHandles");
17
- var ReactMarkupChecksum = require("./ReactMarkupChecksum");
18
- var ReactServerBatchingStrategy = require("./ReactServerBatchingStrategy");
19
- var ReactServerRenderingTransaction = require("./ReactServerRenderingTransaction");
20
- var ReactUpdates = require("./ReactUpdates");
14
+ var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
15
+ var ReactElement = require('./ReactElement');
16
+ var ReactInstanceHandles = require('./ReactInstanceHandles');
17
+ var ReactMarkupChecksum = require('./ReactMarkupChecksum');
18
+ var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
19
+ var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
20
+ var ReactUpdates = require('./ReactUpdates');
21
21
 
22
- var emptyObject = require("./emptyObject");
23
- var instantiateReactComponent = require("./instantiateReactComponent");
24
- var invariant = require("./invariant");
22
+ var emptyObject = require('fbjs/lib/emptyObject');
23
+ var instantiateReactComponent = require('./instantiateReactComponent');
24
+ var invariant = require('fbjs/lib/invariant');
25
25
 
26
26
  /**
27
27
  * @param {ReactElement} element
28
28
  * @return {string} the HTML markup
29
29
  */
30
30
  function renderToString(element) {
31
- !ReactElement.isValidElement(element) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
31
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
32
32
 
33
33
  var transaction;
34
34
  try {
@@ -56,7 +56,7 @@ function renderToString(element) {
56
56
  * (for generating static pages)
57
57
  */
58
58
  function renderToStaticMarkup(element) {
59
- !ReactElement.isValidElement(element) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
59
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
60
60
 
61
61
  var transaction;
62
62
  try {
@@ -12,12 +12,12 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var PooledClass = require("./PooledClass");
16
- var CallbackQueue = require("./CallbackQueue");
17
- var Transaction = require("./Transaction");
15
+ var PooledClass = require('./PooledClass');
16
+ var CallbackQueue = require('./CallbackQueue');
17
+ var Transaction = require('./Transaction');
18
18
 
19
- var assign = require("./Object.assign");
20
- var emptyFunction = require("./emptyFunction");
19
+ var assign = require('./Object.assign');
20
+ var emptyFunction = require('fbjs/lib/emptyFunction');
21
21
 
22
22
  /**
23
23
  * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
@@ -49,6 +49,7 @@ function ReactServerRenderingTransaction(renderToStaticMarkup) {
49
49
  this.reinitializeTransaction();
50
50
  this.renderToStaticMarkup = renderToStaticMarkup;
51
51
  this.reactMountReady = CallbackQueue.getPooled(null);
52
+ this.useCreateElement = false;
52
53
  }
53
54
 
54
55
  var Mixin = {
@@ -11,24 +11,24 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var EventConstants = require("./EventConstants");
15
- var EventPluginHub = require("./EventPluginHub");
16
- var EventPropagators = require("./EventPropagators");
17
- var React = require("./React");
18
- var ReactElement = require("./ReactElement");
19
- var ReactEmptyComponent = require("./ReactEmptyComponent");
20
- var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
21
- var ReactCompositeComponent = require("./ReactCompositeComponent");
22
- var ReactInstanceHandles = require("./ReactInstanceHandles");
23
- var ReactInstanceMap = require("./ReactInstanceMap");
24
- var ReactMount = require("./ReactMount");
25
- var ReactUpdates = require("./ReactUpdates");
26
- var SyntheticEvent = require("./SyntheticEvent");
27
-
28
- var assign = require("./Object.assign");
29
- var emptyObject = require("./emptyObject");
30
- var findDOMNode = require("./findDOMNode");
31
- var invariant = require("./invariant");
14
+ var EventConstants = require('./EventConstants');
15
+ var EventPluginHub = require('./EventPluginHub');
16
+ var EventPropagators = require('./EventPropagators');
17
+ var React = require('./React');
18
+ var ReactDOM = require('./ReactDOM');
19
+ var ReactElement = require('./ReactElement');
20
+ var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
21
+ var ReactCompositeComponent = require('./ReactCompositeComponent');
22
+ var ReactInstanceHandles = require('./ReactInstanceHandles');
23
+ var ReactInstanceMap = require('./ReactInstanceMap');
24
+ var ReactMount = require('./ReactMount');
25
+ var ReactUpdates = require('./ReactUpdates');
26
+ var SyntheticEvent = require('./SyntheticEvent');
27
+
28
+ var assign = require('./Object.assign');
29
+ var emptyObject = require('fbjs/lib/emptyObject');
30
+ var findDOMNode = require('./findDOMNode');
31
+ var invariant = require('fbjs/lib/invariant');
32
32
 
33
33
  var topLevelTypes = EventConstants.topLevelTypes;
34
34
 
@@ -44,6 +44,7 @@ function findAllInRenderedTreeInternal(inst, test) {
44
44
  }
45
45
  var publicInst = inst.getPublicInstance();
46
46
  var ret = test(publicInst) ? [publicInst] : [];
47
+ var currentElement = inst._currentElement;
47
48
  if (ReactTestUtils.isDOMComponent(publicInst)) {
48
49
  var renderedChildren = inst._renderedChildren;
49
50
  var key;
@@ -53,7 +54,7 @@ function findAllInRenderedTreeInternal(inst, test) {
53
54
  }
54
55
  ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
55
56
  }
56
- } else if (ReactTestUtils.isCompositeComponent(publicInst)) {
57
+ } else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
57
58
  ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
58
59
  }
59
60
  return ret;
@@ -72,7 +73,7 @@ var ReactTestUtils = {
72
73
  // clean up, so we're going to stop honoring the name of this method
73
74
  // (and probably rename it eventually) if no problems arise.
74
75
  // document.documentElement.appendChild(div);
75
- return React.render(instance, div);
76
+ return ReactDOM.render(instance, div);
76
77
  },
77
78
 
78
79
  isElement: function (element) {
@@ -99,7 +100,7 @@ var ReactTestUtils = {
99
100
  // this returns when we have DOM nodes as refs directly
100
101
  return false;
101
102
  }
102
- return typeof inst.render === 'function' && typeof inst.setState === 'function';
103
+ return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
103
104
  },
104
105
 
105
106
  isCompositeComponentWithType: function (inst, type) {
@@ -141,7 +142,7 @@ var ReactTestUtils = {
141
142
  if (!inst) {
142
143
  return [];
143
144
  }
144
- !ReactTestUtils.isCompositeComponent(inst) ? 'production' !== process.env.NODE_ENV ? 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) : undefined;
145
146
  return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
146
147
  },
147
148
 
@@ -150,11 +151,16 @@ var ReactTestUtils = {
150
151
  * components with the class name matching `className`.
151
152
  * @return {array} an array of all the matches.
152
153
  */
153
- scryRenderedDOMComponentsWithClass: function (root, className) {
154
+ scryRenderedDOMComponentsWithClass: function (root, classNames) {
155
+ if (!Array.isArray(classNames)) {
156
+ classNames = classNames.split(/\s+/);
157
+ }
154
158
  return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
155
159
  if (ReactTestUtils.isDOMComponent(inst)) {
156
- var instClassName = React.findDOMNode(inst).className;
157
- return instClassName && ('' + instClassName).split(/\s+/).indexOf(className) !== -1;
160
+ var classList = ReactDOM.findDOMNode(inst).className.split(/\s+/);
161
+ return classNames.every(function (className) {
162
+ return classList.indexOf(className) !== -1;
163
+ });
158
164
  }
159
165
  return false;
160
166
  });
@@ -181,7 +187,7 @@ var ReactTestUtils = {
181
187
  */
182
188
  scryRenderedDOMComponentsWithTag: function (root, tagName) {
183
189
  return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
184
- return ReactTestUtils.isDOMComponent(inst) && inst.tagName === tagName.toUpperCase();
190
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
185
191
  });
186
192
  },
187
193
 
@@ -247,7 +253,7 @@ var ReactTestUtils = {
247
253
  },
248
254
 
249
255
  /**
250
- * Simulates a top level event being dispatched from a raw event that occured
256
+ * Simulates a top level event being dispatched from a raw event that occurred
251
257
  * on an `Element` node.
252
258
  * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
253
259
  * @param {!Element} node The dom to simulate an event occurring on.
@@ -259,7 +265,7 @@ var ReactTestUtils = {
259
265
  },
260
266
 
261
267
  /**
262
- * Simulates a top level event being dispatched from a raw event that occured
268
+ * Simulates a top level event being dispatched from a raw event that occurred
263
269
  * on the `ReactDOMComponent` `comp`.
264
270
  * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
265
271
  * @param {!ReactDOMComponent} comp
@@ -296,7 +302,7 @@ ReactShallowRenderer.prototype.getRenderOutput = function () {
296
302
 
297
303
  var NoopInternalComponent = function (element) {
298
304
  this._renderedOutput = element;
299
- this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
305
+ this._currentElement = element;
300
306
  };
301
307
 
302
308
  NoopInternalComponent.prototype = {
@@ -305,7 +311,7 @@ NoopInternalComponent.prototype = {
305
311
 
306
312
  receiveComponent: function (element) {
307
313
  this._renderedOutput = element;
308
- this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
314
+ this._currentElement = element;
309
315
  },
310
316
 
311
317
  unmountComponent: function () {}
@@ -322,10 +328,13 @@ assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
322
328
  });
323
329
 
324
330
  ReactShallowRenderer.prototype.render = function (element, context) {
331
+ !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;
332
+ !(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;
333
+
325
334
  if (!context) {
326
335
  context = emptyObject;
327
336
  }
328
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
337
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
329
338
  this._render(element, transaction, context);
330
339
  ReactUpdates.ReactReconcileTransaction.release(transaction);
331
340
  };
@@ -337,7 +346,9 @@ ReactShallowRenderer.prototype.unmount = function () {
337
346
  };
338
347
 
339
348
  ReactShallowRenderer.prototype._render = function (element, transaction, context) {
340
- if (!this._instance) {
349
+ if (this._instance) {
350
+ this._instance.receiveComponent(element, transaction, context);
351
+ } else {
341
352
  var rootID = ReactInstanceHandles.createReactRootID();
342
353
  var instance = new ShallowComponentWrapper(element.type);
343
354
  instance.construct(element);
@@ -345,8 +356,6 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
345
356
  instance.mountComponent(rootID, transaction, context);
346
357
 
347
358
  this._instance = instance;
348
- } else {
349
- this._instance.receiveComponent(element, transaction, context);
350
359
  }
351
360
  };
352
361
 
@@ -384,7 +393,7 @@ function makeSimulator(eventType) {
384
393
 
385
394
  ReactUpdates.batchedUpdates(function () {
386
395
  EventPluginHub.enqueueEvents(event);
387
- EventPluginHub.processEventQueue();
396
+ EventPluginHub.processEventQueue(true);
388
397
  });
389
398
  };
390
399
  }
@@ -438,15 +447,14 @@ function makeNativeSimulator(eventType) {
438
447
  assign(fakeNativeEvent, nativeEventData);
439
448
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
440
449
  ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
441
- } else if (!!domComponentOrNode.tagName) {
450
+ } else if (domComponentOrNode.tagName) {
442
451
  // Will allow on actual dom nodes.
443
452
  ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
444
453
  }
445
454
  };
446
455
  }
447
456
 
448
- var eventType;
449
- for (eventType in topLevelTypes) {
457
+ Object.keys(topLevelTypes).forEach(function (eventType) {
450
458
  // Event type is stored as 'topClick' - we transform that to 'click'
451
459
  var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
452
460
  /**
@@ -454,6 +462,6 @@ for (eventType in topLevelTypes) {
454
462
  * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
455
463
  */
456
464
  ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
457
- }
465
+ });
458
466
 
459
467
  module.exports = ReactTestUtils;
@@ -12,13 +12,12 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var ReactChildren = require("./ReactChildren");
16
- var ReactFragment = require("./ReactFragment");
15
+ var flattenChildren = require('./flattenChildren');
17
16
 
18
17
  var ReactTransitionChildMapping = {
19
18
  /**
20
19
  * Given `this.props.children`, return an object mapping key to child. Just
21
- * simple syntactic sugar around ReactChildren.map().
20
+ * simple syntactic sugar around flattenChildren().
22
21
  *
23
22
  * @param {*} children `this.props.children`
24
23
  * @return {object} Mapping of key to child
@@ -27,9 +26,7 @@ var ReactTransitionChildMapping = {
27
26
  if (!children) {
28
27
  return children;
29
28
  }
30
- return ReactFragment.extract(ReactChildren.map(children, function (child) {
31
- return child;
32
- }));
29
+ return flattenChildren(children);
33
30
  },
34
31
 
35
32
  /**