react 0.14.0-beta1 → 0.14.0-beta2

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 (169) hide show
  1. package/addons.js +5 -2
  2. package/dist/JSXTransformer.js +588 -227
  3. package/dist/react-with-addons.js +3118 -2707
  4. package/dist/react-with-addons.min.js +6 -6
  5. package/dist/react.js +3713 -3317
  6. package/dist/react.min.js +6 -5
  7. package/lib/AutoFocusUtils.js +3 -3
  8. package/lib/BeforeInputEventPlugin.js +13 -13
  9. package/lib/CSSProperty.js +3 -0
  10. package/lib/CSSPropertyOperations.js +13 -13
  11. package/lib/CallbackQueue.js +4 -4
  12. package/lib/ChangeEventPlugin.js +12 -12
  13. package/lib/DOMChildrenOperations.js +10 -6
  14. package/lib/DOMProperty.js +8 -8
  15. package/lib/DOMPropertyOperations.js +9 -9
  16. package/lib/Danger.js +14 -14
  17. package/lib/DefaultEventPluginOrder.js +2 -2
  18. package/lib/EnterLeaveEventPlugin.js +5 -5
  19. package/lib/EventConstants.js +23 -1
  20. package/lib/EventPluginHub.js +11 -11
  21. package/lib/EventPluginRegistry.js +8 -8
  22. package/lib/EventPluginUtils.js +11 -11
  23. package/lib/EventPropagators.js +7 -7
  24. package/lib/FallbackCompositionState.js +3 -3
  25. package/lib/HTMLDOMPropertyConfig.js +4 -2
  26. package/lib/LinkedStateMixin.js +2 -2
  27. package/lib/LinkedValueUtils.js +8 -8
  28. package/lib/MetaMatchers.js +118 -0
  29. package/lib/OrderedMap.js +453 -0
  30. package/lib/PooledClass.js +2 -2
  31. package/lib/React.js +6 -6
  32. package/lib/ReactBrowserComponentMixin.js +4 -4
  33. package/lib/ReactBrowserEventEmitter.js +30 -7
  34. package/lib/ReactCSSTransitionGroup.js +16 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +12 -11
  36. package/lib/ReactChildReconciler.js +25 -18
  37. package/lib/ReactChildren.js +6 -6
  38. package/lib/ReactClass.js +42 -42
  39. package/lib/ReactComponent.js +13 -13
  40. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  41. package/lib/ReactComponentEnvironment.js +2 -2
  42. package/lib/ReactComponentWithPureRenderMixin.js +1 -1
  43. package/lib/ReactCompositeComponent.js +38 -38
  44. package/lib/ReactDOM.js +72 -159
  45. package/lib/ReactDOMComponent.js +104 -60
  46. package/lib/ReactDOMFactories.js +177 -0
  47. package/lib/ReactDOMIDOperations.js +10 -24
  48. package/lib/ReactDOMInput.js +8 -8
  49. package/lib/ReactDOMOption.js +7 -7
  50. package/lib/ReactDOMSelect.js +8 -8
  51. package/lib/ReactDOMSelection.js +3 -3
  52. package/lib/ReactDOMServer.js +2 -2
  53. package/lib/ReactDOMTextComponent.js +11 -11
  54. package/lib/ReactDOMTextarea.js +11 -11
  55. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  56. package/lib/ReactDefaultInjection.js +24 -24
  57. package/lib/ReactDefaultPerf.js +7 -7
  58. package/lib/ReactDefaultPerfAnalysis.js +6 -9
  59. package/lib/ReactElement.js +4 -4
  60. package/lib/ReactElementValidator.js +21 -21
  61. package/lib/ReactEmptyComponent.js +4 -4
  62. package/lib/ReactEventEmitterMixin.js +1 -1
  63. package/lib/ReactEventListener.js +19 -14
  64. package/lib/ReactFragment.js +11 -11
  65. package/lib/ReactInjection.js +11 -11
  66. package/lib/ReactInputSelection.js +4 -4
  67. package/lib/ReactInstanceHandles.js +10 -11
  68. package/lib/ReactIsomorphic.js +11 -11
  69. package/lib/ReactLink.js +1 -1
  70. package/lib/ReactMarkupChecksum.js +6 -2
  71. package/lib/ReactMount.js +68 -48
  72. package/lib/ReactMultiChild.js +83 -22
  73. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  74. package/lib/ReactNativeComponent.js +3 -3
  75. package/lib/ReactNoopUpdateQueue.js +3 -3
  76. package/lib/ReactOwner.js +3 -3
  77. package/lib/ReactPerf.js +2 -2
  78. package/lib/ReactPropTransferer.js +3 -3
  79. package/lib/ReactPropTypeLocationNames.js +1 -1
  80. package/lib/ReactPropTypeLocations.js +1 -1
  81. package/lib/ReactPropTypes.js +34 -8
  82. package/lib/ReactReconcileTransaction.js +6 -6
  83. package/lib/ReactReconciler.js +12 -12
  84. package/lib/ReactRef.js +1 -1
  85. package/lib/ReactServerBatchingStrategy.js +5 -5
  86. package/lib/ReactServerRendering.js +12 -12
  87. package/lib/ReactServerRenderingTransaction.js +5 -5
  88. package/lib/ReactTestUtils.js +26 -27
  89. package/lib/ReactTransitionChildMapping.js +2 -2
  90. package/lib/ReactTransitionEvents.js +1 -1
  91. package/lib/ReactTransitionGroup.js +5 -6
  92. package/lib/ReactUpdateQueue.js +17 -17
  93. package/lib/ReactUpdates.js +14 -14
  94. package/lib/ReactWithAddons.js +14 -14
  95. package/lib/ResponderEventPlugin.js +514 -0
  96. package/lib/ResponderSyntheticEvent.js +40 -0
  97. package/lib/ResponderTouchHistoryStore.js +180 -0
  98. package/lib/SVGDOMPropertyConfig.js +1 -1
  99. package/lib/SelectEventPlugin.js +9 -9
  100. package/lib/SimpleEventPlugin.js +201 -25
  101. package/lib/SyntheticClipboardEvent.js +1 -1
  102. package/lib/SyntheticCompositionEvent.js +1 -1
  103. package/lib/SyntheticDragEvent.js +1 -1
  104. package/lib/SyntheticEvent.js +3 -3
  105. package/lib/SyntheticFocusEvent.js +1 -1
  106. package/lib/SyntheticInputEvent.js +1 -1
  107. package/lib/SyntheticKeyboardEvent.js +4 -4
  108. package/lib/SyntheticMouseEvent.js +3 -3
  109. package/lib/SyntheticTouchEvent.js +2 -2
  110. package/lib/SyntheticUIEvent.js +2 -2
  111. package/lib/SyntheticWheelEvent.js +1 -1
  112. package/lib/TapEventPlugin.js +119 -0
  113. package/lib/Transaction.js +6 -6
  114. package/lib/accumulate.js +44 -0
  115. package/lib/accumulateInto.js +2 -2
  116. package/lib/adler32.js +19 -7
  117. package/lib/cloneWithProps.js +11 -6
  118. package/lib/createHierarchyRenderer.js +85 -0
  119. package/lib/dangerousStyleValue.js +1 -1
  120. package/lib/deprecated.js +4 -4
  121. package/lib/findDOMNode.js +9 -9
  122. package/lib/flattenChildren.js +4 -4
  123. package/lib/getEventKey.js +1 -1
  124. package/lib/getTestDocument.js +28 -0
  125. package/lib/getTextContentAccessor.js +1 -1
  126. package/lib/instantiateReactComponent.js +12 -12
  127. package/lib/isEventSupported.js +1 -1
  128. package/lib/onlyChild.js +3 -3
  129. package/lib/quoteAttributeValueForBrowser.js +1 -1
  130. package/lib/reactComponentExpect.js +210 -0
  131. package/lib/renderSubtreeIntoContainer.js +1 -1
  132. package/lib/setInnerHTML.js +1 -1
  133. package/lib/setTextContent.js +3 -3
  134. package/lib/shallowCompare.js +1 -1
  135. package/lib/sliceChildren.js +51 -0
  136. package/lib/traverseAllChildren.js +14 -13
  137. package/lib/update.js +13 -13
  138. package/lib/validateDOMNesting.js +6 -6
  139. package/lib/webcomponents.js +6379 -0
  140. package/package.json +4 -6
  141. package/react.js +1 -1
  142. package/lib/CSSCore.js +0 -97
  143. package/lib/EventListener.js +0 -84
  144. package/lib/ExecutionEnvironment.js +0 -38
  145. package/lib/ReactDOMClient.js +0 -90
  146. package/lib/camelize.js +0 -32
  147. package/lib/camelizeStyleName.js +0 -40
  148. package/lib/containsNode.js +0 -55
  149. package/lib/createArrayFromMixed.js +0 -85
  150. package/lib/createNodesFromMarkup.js +0 -84
  151. package/lib/emptyFunction.js +0 -38
  152. package/lib/emptyObject.js +0 -20
  153. package/lib/focusNode.js +0 -26
  154. package/lib/getActiveElement.js +0 -29
  155. package/lib/getMarkupWrap.js +0 -93
  156. package/lib/getUnboundedScrollPosition.js +0 -38
  157. package/lib/hyphenate.js +0 -33
  158. package/lib/hyphenateStyleName.js +0 -39
  159. package/lib/invariant.js +0 -49
  160. package/lib/isNode.js +0 -23
  161. package/lib/isTextNode.js +0 -25
  162. package/lib/keyMirror.js +0 -48
  163. package/lib/keyOf.js +0 -35
  164. package/lib/mapObject.js +0 -51
  165. package/lib/performance.js +0 -23
  166. package/lib/performanceNow.js +0 -28
  167. package/lib/shallowEqual.js +0 -48
  168. package/lib/toArray.js +0 -57
  169. package/lib/warning.js +0 -57
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var keyMirror = require("./keyMirror");
14
+ var keyMirror = require('fbjs/lib/keyMirror');
15
15
 
16
16
  /**
17
17
  * When a component's children are updated, a series of update configuration
@@ -25,6 +25,7 @@ var ReactMultiChildUpdateTypes = keyMirror({
25
25
  INSERT_MARKUP: null,
26
26
  MOVE_EXISTING: null,
27
27
  REMOVE_NODE: null,
28
+ SET_MARKUP: null,
28
29
  TEXT_CONTENT: null
29
30
  });
30
31
 
@@ -11,8 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var assign = require("./Object.assign");
15
- var invariant = require("./invariant");
14
+ var assign = require('./Object.assign');
15
+ var invariant = require('fbjs/lib/invariant');
16
16
 
17
17
  var autoGenerateWrapperClass = null;
18
18
  var genericComponentClass = null;
@@ -63,7 +63,7 @@ function getComponentClassForElement(element) {
63
63
  * @return {function} The internal class constructor function.
64
64
  */
65
65
  function createInternalComponent(element) {
66
- !genericComponentClass ? 'production' !== process.env.NODE_ENV ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
66
+ !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
67
67
  return new genericComponentClass(element.type, element.props);
68
68
  }
69
69
 
@@ -11,11 +11,11 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var warning = require("./warning");
14
+ var warning = require('fbjs/lib/warning');
15
15
 
16
16
  function warnTDZ(publicInstance, callerName) {
17
- if ('production' !== process.env.NODE_ENV) {
18
- 'production' !== process.env.NODE_ENV ? warning(false, '%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 && publicInstance.constructor.displayName || '') : undefined;
17
+ if (process.env.NODE_ENV !== 'production') {
18
+ process.env.NODE_ENV !== 'production' ? warning(false, '%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 && publicInstance.constructor.displayName || '') : undefined;
19
19
  }
20
20
  }
21
21
 
package/lib/ReactOwner.js CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var invariant = require("./invariant");
14
+ var invariant = require('fbjs/lib/invariant');
15
15
 
16
16
  /**
17
17
  * ReactOwners are capable of storing references to owned components.
@@ -64,7 +64,7 @@ var ReactOwner = {
64
64
  * @internal
65
65
  */
66
66
  addComponentAsRefTo: function (component, ref, owner) {
67
- !ReactOwner.isValidOwner(owner) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to add a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
67
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to add a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
68
68
  owner.attachRef(ref, component);
69
69
  },
70
70
 
@@ -78,7 +78,7 @@ var ReactOwner = {
78
78
  * @internal
79
79
  */
80
80
  removeComponentAsRefFrom: function (component, ref, owner) {
81
- !ReactOwner.isValidOwner(owner) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to remove a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
81
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to remove a ref from a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
82
82
  // Check that `component` is still the current ref because we do not want to
83
83
  // detach the ref if another component stole it.
84
84
  if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
package/lib/ReactPerf.js CHANGED
@@ -35,7 +35,7 @@ var ReactPerf = {
35
35
  * @param {object<string>} methodNames
36
36
  */
37
37
  measureMethods: function (object, objectName, methodNames) {
38
- if ('production' !== process.env.NODE_ENV) {
38
+ if (process.env.NODE_ENV !== 'production') {
39
39
  for (var key in methodNames) {
40
40
  if (!methodNames.hasOwnProperty(key)) {
41
41
  continue;
@@ -54,7 +54,7 @@ var ReactPerf = {
54
54
  * @return {function}
55
55
  */
56
56
  measure: function (objName, fnName, func) {
57
- if ('production' !== process.env.NODE_ENV) {
57
+ if (process.env.NODE_ENV !== 'production') {
58
58
  var measuredFunc = null;
59
59
  var wrapper = function () {
60
60
  if (ReactPerf.enableMeasure) {
@@ -11,9 +11,9 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var assign = require("./Object.assign");
15
- var emptyFunction = require("./emptyFunction");
16
- var joinClasses = require("./joinClasses");
14
+ var assign = require('./Object.assign');
15
+ var emptyFunction = require('fbjs/lib/emptyFunction');
16
+ var joinClasses = require('./joinClasses');
17
17
 
18
18
  /**
19
19
  * Creates a transfer strategy that will merge prop values using the supplied
@@ -13,7 +13,7 @@
13
13
 
14
14
  var ReactPropTypeLocationNames = {};
15
15
 
16
- if ('production' !== process.env.NODE_ENV) {
16
+ if (process.env.NODE_ENV !== 'production') {
17
17
  ReactPropTypeLocationNames = {
18
18
  prop: 'prop',
19
19
  context: 'context',
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var keyMirror = require("./keyMirror");
14
+ var keyMirror = require('fbjs/lib/keyMirror');
15
15
 
16
16
  var ReactPropTypeLocations = keyMirror({
17
17
  prop: null,
@@ -11,11 +11,12 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactElement = require("./ReactElement");
15
- var ReactFragment = require("./ReactFragment");
16
- var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
14
+ var ReactElement = require('./ReactElement');
15
+ var ReactFragment = require('./ReactFragment');
16
+ var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
17
17
 
18
- var emptyFunction = require("./emptyFunction");
18
+ var emptyFunction = require('fbjs/lib/emptyFunction');
19
+ var getIteratorFn = require('./getIteratorFn');
19
20
 
20
21
  /**
21
22
  * Collection of methods that allow declaration and validation of props that are
@@ -283,12 +284,37 @@ function isNode(propValue) {
283
284
  if (propValue === null || ReactElement.isValidElement(propValue)) {
284
285
  return true;
285
286
  }
286
- propValue = ReactFragment.extractIfFragment(propValue);
287
- for (var k in propValue) {
288
- if (!isNode(propValue[k])) {
289
- return false;
287
+
288
+ var iteratorFn = getIteratorFn(propValue);
289
+ if (iteratorFn) {
290
+ var iterator = iteratorFn.call(propValue);
291
+ var step;
292
+ if (iteratorFn !== propValue.entries) {
293
+ while (!(step = iterator.next()).done) {
294
+ if (!isNode(step.value)) {
295
+ return false;
296
+ }
297
+ }
298
+ } else {
299
+ // Iterator will provide entry [k,v] tuples rather than values.
300
+ while (!(step = iterator.next()).done) {
301
+ var entry = step.value;
302
+ if (entry) {
303
+ if (!isNode(entry[1])) {
304
+ return false;
305
+ }
306
+ }
307
+ }
308
+ }
309
+ } else {
310
+ propValue = ReactFragment.extractIfFragment(propValue);
311
+ for (var k in propValue) {
312
+ if (!isNode(propValue[k])) {
313
+ return false;
314
+ }
290
315
  }
291
316
  }
317
+
292
318
  return true;
293
319
  default:
294
320
  return false;
@@ -12,13 +12,13 @@
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 ReactInputSelection = require('./ReactInputSelection');
19
+ var Transaction = require('./Transaction');
20
20
 
21
- var assign = require("./Object.assign");
21
+ var assign = require('./Object.assign');
22
22
 
23
23
  /**
24
24
  * Ensures that, when possible, the selection range (currently selected text
@@ -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
@@ -66,18 +66,18 @@ var ReactReconciler = {
66
66
  if (nextElement === prevElement && nextElement._owner != null
67
67
  // TODO: Shouldn't we need to do this: `&& context === internalInstance._context`
68
68
  ) {
69
- // Since elements are immutable after the owner is rendered,
70
- // we can do a cheap identity compare here to determine if this is a
71
- // superfluous reconcile. It's possible for state to be mutable but such
72
- // change should trigger an update of the owner which would recreate
73
- // the element. We explicitly check for the existence of an owner since
74
- // it's possible for an element created outside a composite to be
75
- // deeply mutated and reused.
69
+ // Since elements are immutable after the owner is rendered,
70
+ // we can do a cheap identity compare here to determine if this is a
71
+ // superfluous reconcile. It's possible for state to be mutable but such
72
+ // change should trigger an update of the owner which would recreate
73
+ // the element. We explicitly check for the existence of an owner since
74
+ // it's possible for an element created outside a composite to be
75
+ // deeply mutated and reused.
76
76
 
77
- // TODO: Bailing out early is just a perf optimization right?
78
- // TODO: Removing the return statement should affect correctness?
79
- return;
80
- }
77
+ // TODO: Bailing out early is just a perf optimization right?
78
+ // TODO: Removing the return statement should affect correctness?
79
+ return;
80
+ }
81
81
 
82
82
  var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
83
83
 
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
 
@@ -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
@@ -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 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('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
 
@@ -141,7 +141,7 @@ var ReactTestUtils = {
141
141
  if (!inst) {
142
142
  return [];
143
143
  }
144
- !ReactTestUtils.isCompositeComponent(inst) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
144
+ !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
145
145
  return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
146
146
  },
147
147
 
@@ -181,7 +181,7 @@ var ReactTestUtils = {
181
181
  */
182
182
  scryRenderedDOMComponentsWithTag: function (root, tagName) {
183
183
  return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
184
- return ReactTestUtils.isDOMComponent(inst) && inst.tagName === tagName.toUpperCase();
184
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
185
185
  });
186
186
  },
187
187
 
@@ -337,7 +337,9 @@ ReactShallowRenderer.prototype.unmount = function () {
337
337
  };
338
338
 
339
339
  ReactShallowRenderer.prototype._render = function (element, transaction, context) {
340
- if (!this._instance) {
340
+ if (this._instance) {
341
+ this._instance.receiveComponent(element, transaction, context);
342
+ } else {
341
343
  var rootID = ReactInstanceHandles.createReactRootID();
342
344
  var instance = new ShallowComponentWrapper(element.type);
343
345
  instance.construct(element);
@@ -345,8 +347,6 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
345
347
  instance.mountComponent(rootID, transaction, context);
346
348
 
347
349
  this._instance = instance;
348
- } else {
349
- this._instance.receiveComponent(element, transaction, context);
350
350
  }
351
351
  };
352
352
 
@@ -438,15 +438,14 @@ function makeNativeSimulator(eventType) {
438
438
  assign(fakeNativeEvent, nativeEventData);
439
439
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
440
440
  ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
441
- } else if (!!domComponentOrNode.tagName) {
441
+ } else if (domComponentOrNode.tagName) {
442
442
  // Will allow on actual dom nodes.
443
443
  ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
444
444
  }
445
445
  };
446
446
  }
447
447
 
448
- var eventType;
449
- for (eventType in topLevelTypes) {
448
+ Object.keys(topLevelTypes).forEach(function (eventType) {
450
449
  // Event type is stored as 'topClick' - we transform that to 'click'
451
450
  var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
452
451
  /**
@@ -454,6 +453,6 @@ for (eventType in topLevelTypes) {
454
453
  * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
455
454
  */
456
455
  ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
457
- }
456
+ });
458
457
 
459
458
  module.exports = ReactTestUtils;