react 0.14.0-beta2 → 0.14.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 (89) hide show
  1. package/README.md +4 -4
  2. package/addons.js +3 -1
  3. package/dist/react-with-addons.js +1944 -1375
  4. package/dist/react-with-addons.min.js +6 -6
  5. package/dist/react.js +1704 -1250
  6. package/dist/react.min.js +6 -6
  7. package/lib/CSSProperty.js +15 -3
  8. package/lib/CSSPropertyOperations.js +15 -2
  9. package/lib/ChangeEventPlugin.js +5 -2
  10. package/lib/DOMChildrenOperations.js +12 -1
  11. package/lib/DOMPropertyOperations.js +14 -1
  12. package/lib/Danger.js +9 -4
  13. package/lib/EnterLeaveEventPlugin.js +13 -5
  14. package/lib/EventConstants.js +2 -2
  15. package/lib/EventPluginHub.js +18 -10
  16. package/lib/EventPluginUtils.js +23 -27
  17. package/lib/EventPropagators.js +1 -1
  18. package/lib/FallbackCompositionState.js +6 -0
  19. package/lib/HTMLDOMPropertyConfig.js +25 -2
  20. package/lib/PooledClass.js +1 -3
  21. package/lib/React.js +14 -3
  22. package/lib/ReactBrowserComponentMixin.js +1 -1
  23. package/lib/ReactBrowserEventEmitter.js +10 -4
  24. package/lib/ReactCSSTransitionGroup.js +33 -18
  25. package/lib/ReactCSSTransitionGroupChild.js +42 -25
  26. package/lib/ReactChildReconciler.js +3 -5
  27. package/lib/ReactChildren.js +70 -30
  28. package/lib/ReactClass.js +6 -6
  29. package/lib/ReactComponent.js +7 -6
  30. package/lib/ReactCompositeComponent.js +58 -7
  31. package/lib/ReactDOM.js +7 -5
  32. package/lib/ReactDOMComponent.js +140 -46
  33. package/lib/ReactDOMFeatureFlags.js +18 -0
  34. package/lib/ReactDOMIDOperations.js +1 -60
  35. package/lib/ReactDOMInput.js +10 -1
  36. package/lib/ReactDOMSelect.js +1 -1
  37. package/lib/ReactDOMSelection.js +16 -0
  38. package/lib/ReactDOMServer.js +3 -1
  39. package/lib/ReactDOMTextComponent.js +23 -10
  40. package/lib/ReactDOMTextarea.js +3 -1
  41. package/lib/ReactDefaultInjection.js +0 -2
  42. package/lib/ReactDefaultPerf.js +10 -4
  43. package/lib/ReactDefaultPerfAnalysis.js +7 -3
  44. package/lib/ReactElement.js +72 -35
  45. package/lib/ReactElementValidator.js +31 -75
  46. package/lib/ReactEmptyComponent.js +25 -61
  47. package/lib/ReactEmptyComponentRegistry.js +48 -0
  48. package/lib/ReactErrorUtils.js +55 -9
  49. package/lib/ReactEventEmitterMixin.js +1 -1
  50. package/lib/ReactEventListener.js +16 -9
  51. package/lib/ReactFragment.js +25 -116
  52. package/lib/ReactInjection.js +0 -2
  53. package/lib/ReactIsomorphic.js +4 -0
  54. package/lib/ReactLink.js +1 -1
  55. package/lib/ReactMount.js +127 -41
  56. package/lib/ReactMultiChild.js +37 -4
  57. package/lib/ReactOwner.js +2 -2
  58. package/lib/ReactPropTransferer.js +1 -1
  59. package/lib/ReactPropTypes.js +11 -8
  60. package/lib/ReactReconcileTransaction.js +4 -2
  61. package/lib/ReactReconciler.js +16 -17
  62. package/lib/ReactRef.js +13 -1
  63. package/lib/ReactServerRenderingTransaction.js +1 -0
  64. package/lib/ReactTestUtils.js +27 -15
  65. package/lib/ReactTransitionChildMapping.js +3 -6
  66. package/lib/ReactUpdateQueue.js +4 -4
  67. package/lib/ReactUpdates.js +1 -1
  68. package/lib/ReactVersion.js +14 -0
  69. package/lib/ReactWithAddons.js +10 -1
  70. package/lib/ResponderEventPlugin.js +1 -1
  71. package/lib/SelectEventPlugin.js +11 -1
  72. package/lib/SimpleEventPlugin.js +10 -31
  73. package/lib/SyntheticEvent.js +15 -1
  74. package/lib/Transaction.js +1 -1
  75. package/lib/canDefineProperty.js +24 -0
  76. package/lib/createHierarchyRenderer.js +1 -1
  77. package/lib/deprecated.js +3 -2
  78. package/lib/findDOMNode.js +1 -1
  79. package/lib/getTestDocument.js +4 -11
  80. package/lib/instantiateReactComponent.js +3 -5
  81. package/lib/reactComponentExpect.js +6 -0
  82. package/lib/shouldUpdateReactComponent.js +12 -8
  83. package/lib/sliceChildren.js +3 -20
  84. package/lib/traverseAllChildren.js +15 -9
  85. package/package.json +2 -2
  86. package/react.js +1 -51
  87. package/dist/JSXTransformer.js +0 -17949
  88. package/lib/joinClasses.js +0 -39
  89. package/lib/memoizeStringOnly.js +0 -31
@@ -15,9 +15,12 @@
15
15
  var ReactComponentEnvironment = require('./ReactComponentEnvironment');
16
16
  var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
17
17
 
18
+ var ReactCurrentOwner = require('./ReactCurrentOwner');
18
19
  var ReactReconciler = require('./ReactReconciler');
19
20
  var ReactChildReconciler = require('./ReactChildReconciler');
20
21
 
22
+ var flattenChildren = require('./flattenChildren');
23
+
21
24
  /**
22
25
  * Updating children of a component may trigger recursive updates. The depth is
23
26
  * used to batch recursive updates to render markup more efficiently.
@@ -186,6 +189,37 @@ var ReactMultiChild = {
186
189
  */
187
190
  Mixin: {
188
191
 
192
+ _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
193
+ if (process.env.NODE_ENV !== 'production') {
194
+ if (this._currentElement) {
195
+ try {
196
+ ReactCurrentOwner.current = this._currentElement._owner;
197
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
198
+ } finally {
199
+ ReactCurrentOwner.current = null;
200
+ }
201
+ }
202
+ }
203
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
204
+ },
205
+
206
+ _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
207
+ var nextChildren;
208
+ if (process.env.NODE_ENV !== 'production') {
209
+ if (this._currentElement) {
210
+ try {
211
+ ReactCurrentOwner.current = this._currentElement._owner;
212
+ nextChildren = flattenChildren(nextNestedChildrenElements);
213
+ } finally {
214
+ ReactCurrentOwner.current = null;
215
+ }
216
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
217
+ }
218
+ }
219
+ nextChildren = flattenChildren(nextNestedChildrenElements);
220
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
221
+ },
222
+
189
223
  /**
190
224
  * Generates a "mount image" for each of the supplied children. In the case
191
225
  * of `ReactDOMComponent`, a mount image is a string of markup.
@@ -195,7 +229,7 @@ var ReactMultiChild = {
195
229
  * @internal
196
230
  */
197
231
  mountChildren: function (nestedChildren, transaction, context) {
198
- var children = ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
232
+ var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
199
233
  this._renderedChildren = children;
200
234
  var mountImages = [];
201
235
  var index = 0;
@@ -205,9 +239,8 @@ var ReactMultiChild = {
205
239
  // Inlined for performance, see `ReactInstanceHandles.createReactID`.
206
240
  var rootID = this._rootNodeID + name;
207
241
  var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
208
- child._mountIndex = index;
242
+ child._mountIndex = index++;
209
243
  mountImages.push(mountImage);
210
- index++;
211
244
  }
212
245
  }
213
246
  return mountImages;
@@ -315,7 +348,7 @@ var ReactMultiChild = {
315
348
  */
316
349
  _updateChildren: function (nextNestedChildrenElements, transaction, context) {
317
350
  var prevChildren = this._renderedChildren;
318
- var nextChildren = ReactChildReconciler.updateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
351
+ var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
319
352
  this._renderedChildren = nextChildren;
320
353
  if (!nextChildren && !prevChildren) {
321
354
  return;
package/lib/ReactOwner.js CHANGED
@@ -64,7 +64,7 @@ var ReactOwner = {
64
64
  * @internal
65
65
  */
66
66
  addComponentAsRefTo: function (component, ref, owner) {
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;
67
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : 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) ? 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;
81
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : 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()) {
@@ -13,7 +13,7 @@
13
13
 
14
14
  var assign = require('./Object.assign');
15
15
  var emptyFunction = require('fbjs/lib/emptyFunction');
16
- var joinClasses = require('./joinClasses');
16
+ var joinClasses = require('fbjs/lib/joinClasses');
17
17
 
18
18
  /**
19
19
  * Creates a transfer strategy that will merge prop values using the supplied
@@ -12,7 +12,6 @@
12
12
  'use strict';
13
13
 
14
14
  var ReactElement = require('./ReactElement');
15
- var ReactFragment = require('./ReactFragment');
16
15
  var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
17
16
 
18
17
  var emptyFunction = require('fbjs/lib/emptyFunction');
@@ -164,7 +163,8 @@ function createInstanceTypeChecker(expectedClass) {
164
163
  if (!(props[propName] instanceof expectedClass)) {
165
164
  var locationName = ReactPropTypeLocationNames[location];
166
165
  var expectedClassName = expectedClass.name || ANONYMOUS;
167
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected instance of `' + expectedClassName + '`.'));
166
+ var actualClassName = getClassName(props[propName]);
167
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
168
168
  }
169
169
  return null;
170
170
  }
@@ -307,12 +307,7 @@ function isNode(propValue) {
307
307
  }
308
308
  }
309
309
  } else {
310
- propValue = ReactFragment.extractIfFragment(propValue);
311
- for (var k in propValue) {
312
- if (!isNode(propValue[k])) {
313
- return false;
314
- }
315
- }
310
+ return false;
316
311
  }
317
312
 
318
313
  return true;
@@ -350,4 +345,12 @@ function getPreciseType(propValue) {
350
345
  return propType;
351
346
  }
352
347
 
348
+ // Returns class name of the object, if any.
349
+ function getClassName(propValue) {
350
+ if (!propValue.constructor || !propValue.constructor.name) {
351
+ return '<<anonymous>>';
352
+ }
353
+ return propValue.constructor.name;
354
+ }
355
+
353
356
  module.exports = ReactPropTypes;
@@ -15,6 +15,7 @@
15
15
  var CallbackQueue = require('./CallbackQueue');
16
16
  var PooledClass = require('./PooledClass');
17
17
  var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
18
+ var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
18
19
  var ReactInputSelection = require('./ReactInputSelection');
19
20
  var Transaction = require('./Transaction');
20
21
 
@@ -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 = {
@@ -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,21 +63,20 @@ 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
- ) {
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
-
77
- // TODO: Bailing out early is just a perf optimization right?
78
- // TODO: Removing the return statement should affect correctness?
79
- return;
80
- }
66
+
67
+ if (nextElement === prevElement && context === internalInstance._context) {
68
+ // Since elements are immutable after the owner is rendered,
69
+ // we can do a cheap identity compare here to determine if this is a
70
+ // superfluous reconcile. It's possible for state to be mutable but such
71
+ // change should trigger an update of the owner which would recreate
72
+ // the element. We explicitly check for the existence of an owner since
73
+ // it's possible for an element created outside a composite to be
74
+ // deeply mutated and reused.
75
+
76
+ // TODO: Bailing out early is just a perf optimization right?
77
+ // TODO: Removing the return statement should affect correctness?
78
+ return;
79
+ }
81
80
 
82
81
  var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
83
82
 
@@ -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
@@ -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);
@@ -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 = {
@@ -15,8 +15,8 @@ var EventConstants = require('./EventConstants');
15
15
  var EventPluginHub = require('./EventPluginHub');
16
16
  var EventPropagators = require('./EventPropagators');
17
17
  var React = require('./React');
18
+ var ReactDOM = require('./ReactDOM');
18
19
  var ReactElement = require('./ReactElement');
19
- var ReactEmptyComponent = require('./ReactEmptyComponent');
20
20
  var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
21
21
  var ReactCompositeComponent = require('./ReactCompositeComponent');
22
22
  var ReactInstanceHandles = require('./ReactInstanceHandles');
@@ -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) {
@@ -84,8 +85,6 @@ var ReactTestUtils = {
84
85
  },
85
86
 
86
87
  isDOMComponent: function (inst) {
87
- // TODO: Fix this heuristic. It's just here because composites can currently
88
- // pretend to be DOM components.
89
88
  return !!(inst && inst.nodeType === 1 && inst.tagName);
90
89
  },
91
90
 
@@ -99,7 +98,7 @@ var ReactTestUtils = {
99
98
  // this returns when we have DOM nodes as refs directly
100
99
  return false;
101
100
  }
102
- return typeof inst.render === 'function' && typeof inst.setState === 'function';
101
+ return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
103
102
  },
104
103
 
105
104
  isCompositeComponentWithType: function (inst, type) {
@@ -150,11 +149,21 @@ var ReactTestUtils = {
150
149
  * components with the class name matching `className`.
151
150
  * @return {array} an array of all the matches.
152
151
  */
153
- scryRenderedDOMComponentsWithClass: function (root, className) {
152
+ scryRenderedDOMComponentsWithClass: function (root, classNames) {
153
+ if (!Array.isArray(classNames)) {
154
+ classNames = classNames.split(/\s+/);
155
+ }
154
156
  return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
155
157
  if (ReactTestUtils.isDOMComponent(inst)) {
156
- var instClassName = React.findDOMNode(inst).className;
157
- return instClassName && ('' + instClassName).split(/\s+/).indexOf(className) !== -1;
158
+ var className = inst.className;
159
+ if (typeof className !== 'string') {
160
+ // SVG, probably.
161
+ className = inst.getAttribute('class') || '';
162
+ }
163
+ var classList = className.split(/\s+/);
164
+ return classNames.every(function (name) {
165
+ return classList.indexOf(name) !== -1;
166
+ });
158
167
  }
159
168
  return false;
160
169
  });
@@ -247,7 +256,7 @@ var ReactTestUtils = {
247
256
  },
248
257
 
249
258
  /**
250
- * Simulates a top level event being dispatched from a raw event that occured
259
+ * Simulates a top level event being dispatched from a raw event that occurred
251
260
  * on an `Element` node.
252
261
  * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
253
262
  * @param {!Element} node The dom to simulate an event occurring on.
@@ -259,7 +268,7 @@ var ReactTestUtils = {
259
268
  },
260
269
 
261
270
  /**
262
- * Simulates a top level event being dispatched from a raw event that occured
271
+ * Simulates a top level event being dispatched from a raw event that occurred
263
272
  * on the `ReactDOMComponent` `comp`.
264
273
  * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
265
274
  * @param {!ReactDOMComponent} comp
@@ -296,7 +305,7 @@ ReactShallowRenderer.prototype.getRenderOutput = function () {
296
305
 
297
306
  var NoopInternalComponent = function (element) {
298
307
  this._renderedOutput = element;
299
- this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
308
+ this._currentElement = element;
300
309
  };
301
310
 
302
311
  NoopInternalComponent.prototype = {
@@ -305,7 +314,7 @@ NoopInternalComponent.prototype = {
305
314
 
306
315
  receiveComponent: function (element) {
307
316
  this._renderedOutput = element;
308
- this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
317
+ this._currentElement = element;
309
318
  },
310
319
 
311
320
  unmountComponent: function () {}
@@ -322,10 +331,13 @@ assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
322
331
  });
323
332
 
324
333
  ReactShallowRenderer.prototype.render = function (element, context) {
334
+ !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;
335
+ !(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;
336
+
325
337
  if (!context) {
326
338
  context = emptyObject;
327
339
  }
328
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
340
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
329
341
  this._render(element, transaction, context);
330
342
  ReactUpdates.ReactReconcileTransaction.release(transaction);
331
343
  };
@@ -384,7 +396,7 @@ function makeSimulator(eventType) {
384
396
 
385
397
  ReactUpdates.batchedUpdates(function () {
386
398
  EventPluginHub.enqueueEvents(event);
387
- EventPluginHub.processEventQueue();
399
+ EventPluginHub.processEventQueue(true);
388
400
  });
389
401
  };
390
402
  }
@@ -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
  /**
@@ -25,10 +25,6 @@ function enqueueUpdate(internalInstance) {
25
25
  }
26
26
 
27
27
  function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
28
- if (process.env.NODE_ENV !== 'production') {
29
- 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;
30
- }
31
-
32
28
  var internalInstance = ReactInstanceMap.get(publicInstance);
33
29
  if (!internalInstance) {
34
30
  if (process.env.NODE_ENV !== 'production') {
@@ -40,6 +36,10 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
40
36
  return null;
41
37
  }
42
38
 
39
+ 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;
41
+ }
42
+
43
43
  return internalInstance;
44
44
  }
45
45