react 0.13.3 → 0.14.0-alpha1

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/addons.js +7 -0
  2. package/addons/CSSTransitionGroup.js +1 -0
  3. package/addons/LinkedStateMixin.js +1 -0
  4. package/addons/Perf.js +1 -0
  5. package/addons/PureRenderMixin.js +1 -0
  6. package/addons/TestUtils.js +1 -0
  7. package/addons/TransitionGroup.js +1 -0
  8. package/addons/batchedUpdates.js +1 -0
  9. package/addons/cloneWithProps.js +1 -0
  10. package/addons/createFragment.js +1 -0
  11. package/addons/renderSubtreeIntoContainer.js +1 -0
  12. package/addons/shallowCompare.js +1 -0
  13. package/addons/update.js +1 -0
  14. package/dist/JSXTransformer.js +3355 -1685
  15. package/dist/react-with-addons.js +3092 -5145
  16. package/dist/react-with-addons.min.js +6 -8
  17. package/dist/react.js +2772 -4594
  18. package/dist/react.min.js +5 -6
  19. package/lib/AutoFocusMixin.js +4 -3
  20. package/lib/BeforeInputEventPlugin.js +30 -118
  21. package/lib/CSSCore.js +12 -23
  22. package/lib/CSSProperty.js +4 -3
  23. package/lib/CSSPropertyOperations.js +14 -30
  24. package/lib/CallbackQueue.js +7 -10
  25. package/lib/ChangeEventPlugin.js +24 -88
  26. package/lib/ClientReactRootIndex.js +2 -2
  27. package/lib/DOMChildrenOperations.js +13 -33
  28. package/lib/DOMProperty.js +41 -65
  29. package/lib/DOMPropertyOperations.js +30 -51
  30. package/lib/Danger.js +19 -60
  31. package/lib/DefaultEventPluginOrder.js +2 -12
  32. package/lib/EnterLeaveEventPlugin.js +11 -33
  33. package/lib/EventConstants.js +2 -2
  34. package/lib/EventListener.js +11 -13
  35. package/lib/EventPluginHub.js +44 -47
  36. package/lib/EventPluginRegistry.js +18 -74
  37. package/lib/EventPluginUtils.js +27 -38
  38. package/lib/EventPropagators.js +23 -26
  39. package/lib/ExecutionEnvironment.js +4 -8
  40. package/lib/FallbackCompositionState.js +3 -3
  41. package/lib/HTMLDOMPropertyConfig.js +5 -17
  42. package/lib/LinkedStateMixin.js +3 -6
  43. package/lib/LinkedValueUtils.js +34 -64
  44. package/lib/LocalEventTrapMixin.js +9 -16
  45. package/lib/Object.assign.js +1 -1
  46. package/lib/PooledClass.js +8 -11
  47. package/lib/React.js +20 -38
  48. package/lib/ReactBrowserComponentMixin.js +9 -2
  49. package/lib/ReactBrowserEventEmitter.js +26 -82
  50. package/lib/ReactCSSTransitionGroup.js +13 -24
  51. package/lib/ReactCSSTransitionGroupChild.js +18 -28
  52. package/lib/ReactChildReconciler.js +11 -19
  53. package/lib/ReactChildren.js +7 -16
  54. package/lib/ReactClass.js +78 -231
  55. package/lib/ReactComponent.js +17 -51
  56. package/lib/ReactComponentBrowserEnvironment.js +4 -6
  57. package/lib/ReactComponentEnvironment.js +6 -12
  58. package/lib/ReactComponentWithPureRenderMixin.js +4 -5
  59. package/lib/ReactCompositeComponent.js +83 -318
  60. package/lib/ReactContext.js +2 -44
  61. package/lib/ReactCurrentOwner.js +1 -3
  62. package/lib/ReactDOM.js +3 -2
  63. package/lib/ReactDOMButton.js +3 -4
  64. package/lib/ReactDOMComponent.js +182 -148
  65. package/lib/ReactDOMForm.js +3 -3
  66. package/lib/ReactDOMIDOperations.js +11 -20
  67. package/lib/ReactDOMIframe.js +3 -3
  68. package/lib/ReactDOMImg.js +3 -3
  69. package/lib/ReactDOMInput.js +22 -35
  70. package/lib/ReactDOMOption.js +52 -10
  71. package/lib/ReactDOMSelect.js +50 -28
  72. package/lib/ReactDOMSelection.js +5 -20
  73. package/lib/ReactDOMTextComponent.js +17 -18
  74. package/lib/ReactDOMTextarea.js +15 -27
  75. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  76. package/lib/ReactDefaultInjection.js +21 -40
  77. package/lib/ReactDefaultPerf.js +36 -69
  78. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  79. package/lib/ReactElement.js +35 -72
  80. package/lib/ReactElementValidator.js +51 -110
  81. package/lib/ReactEmptyComponent.js +7 -11
  82. package/lib/ReactErrorUtils.js +2 -2
  83. package/lib/ReactEventEmitterMixin.js +3 -12
  84. package/lib/ReactEventListener.js +16 -38
  85. package/lib/ReactFragment.js +23 -54
  86. package/lib/ReactInjection.js +1 -1
  87. package/lib/ReactInputSelection.js +11 -21
  88. package/lib/ReactInstanceHandles.js +27 -57
  89. package/lib/ReactInstanceMap.js +5 -5
  90. package/lib/ReactLifeCycle.js +1 -1
  91. package/lib/ReactLink.js +2 -4
  92. package/lib/ReactMarkupChecksum.js +5 -10
  93. package/lib/ReactMount.js +136 -260
  94. package/lib/ReactMultiChild.js +19 -45
  95. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  96. package/lib/ReactNativeComponent.js +7 -11
  97. package/lib/ReactOwner.js +7 -24
  98. package/lib/ReactPerf.js +8 -12
  99. package/lib/ReactPropTransferer.js +4 -4
  100. package/lib/ReactPropTypeLocationNames.js +2 -2
  101. package/lib/ReactPropTypeLocations.js +1 -1
  102. package/lib/ReactPropTypes.js +13 -46
  103. package/lib/ReactReconcileTransaction.js +9 -34
  104. package/lib/ReactReconciler.js +9 -19
  105. package/lib/ReactRef.js +5 -8
  106. package/lib/ReactRootIndex.js +2 -2
  107. package/lib/ReactServerRendering.js +7 -15
  108. package/lib/ReactServerRenderingTransaction.js +7 -32
  109. package/lib/ReactStateSetters.js +6 -6
  110. package/lib/ReactTestUtils.js +89 -165
  111. package/lib/ReactTransitionChildMapping.js +5 -7
  112. package/lib/ReactTransitionEvents.js +5 -5
  113. package/lib/ReactTransitionGroup.js +30 -52
  114. package/lib/ReactUpdateQueue.js +27 -90
  115. package/lib/ReactUpdates.js +27 -79
  116. package/lib/ReactWithAddons.js +7 -6
  117. package/lib/SVGDOMPropertyConfig.js +39 -2
  118. package/lib/SelectEventPlugin.js +28 -29
  119. package/lib/ServerReactRootIndex.js +2 -2
  120. package/lib/SimpleEventPlugin.js +136 -128
  121. package/lib/SyntheticClipboardEvent.js +3 -7
  122. package/lib/SyntheticCompositionEvent.js +3 -9
  123. package/lib/SyntheticDragEvent.js +1 -1
  124. package/lib/SyntheticEvent.js +8 -10
  125. package/lib/SyntheticFocusEvent.js +1 -1
  126. package/lib/SyntheticInputEvent.js +3 -9
  127. package/lib/SyntheticKeyboardEvent.js +4 -4
  128. package/lib/SyntheticMouseEvent.js +8 -14
  129. package/lib/SyntheticTouchEvent.js +1 -1
  130. package/lib/SyntheticUIEvent.js +3 -3
  131. package/lib/SyntheticWheelEvent.js +11 -15
  132. package/lib/Transaction.js +12 -24
  133. package/lib/ViewportMetrics.js +2 -2
  134. package/lib/accumulateInto.js +2 -5
  135. package/lib/adler32.js +2 -2
  136. package/lib/camelize.js +4 -2
  137. package/lib/camelizeStyleName.js +2 -2
  138. package/lib/cloneWithProps.js +5 -11
  139. package/lib/containsNode.js +29 -16
  140. package/lib/createArrayFromMixed.js +17 -16
  141. package/lib/createFullPageComponent.js +4 -11
  142. package/lib/createNodesFromMarkup.js +6 -8
  143. package/lib/dangerousStyleValue.js +2 -3
  144. package/lib/emptyFunction.js +10 -4
  145. package/lib/emptyObject.js +1 -1
  146. package/lib/escapeTextContentForBrowser.js +1 -1
  147. package/lib/findDOMNode.js +5 -24
  148. package/lib/flattenChildren.js +4 -10
  149. package/lib/focusNode.js +2 -3
  150. package/lib/forEachAccumulated.js +2 -2
  151. package/lib/getActiveElement.js +4 -2
  152. package/lib/getEventCharCode.js +1 -1
  153. package/lib/getEventKey.js +1 -1
  154. package/lib/getEventModifierState.js +1 -1
  155. package/lib/getEventTarget.js +1 -1
  156. package/lib/getIteratorFn.js +2 -4
  157. package/lib/getMarkupWrap.js +5 -5
  158. package/lib/getNodeForCharacterOffset.js +1 -1
  159. package/lib/getTextContentAccessor.js +2 -4
  160. package/lib/getUnboundedScrollPosition.js +1 -1
  161. package/lib/hyphenate.js +3 -1
  162. package/lib/hyphenateStyleName.js +2 -2
  163. package/lib/instantiateReactComponent.js +14 -38
  164. package/lib/invariant.js +8 -12
  165. package/lib/isEventSupported.js +7 -10
  166. package/lib/isNode.js +4 -6
  167. package/lib/isTextInputElement.js +2 -4
  168. package/lib/isTextNode.js +3 -1
  169. package/lib/joinClasses.js +2 -2
  170. package/lib/keyMirror.js +3 -6
  171. package/lib/keyOf.js +4 -3
  172. package/lib/mapObject.js +1 -1
  173. package/lib/memoizeStringOnly.js +2 -2
  174. package/lib/onlyChild.js +2 -5
  175. package/lib/performance.js +2 -5
  176. package/lib/performanceNow.js +3 -1
  177. package/lib/quoteAttributeValueForBrowser.js +1 -1
  178. package/lib/renderSubtreeIntoContainer.js +16 -0
  179. package/lib/setInnerHTML.js +11 -8
  180. package/lib/setTextContent.js +3 -3
  181. package/lib/shallowCompare.js +24 -0
  182. package/lib/shallowEqual.js +17 -11
  183. package/lib/shouldUpdateReactComponent.js +3 -64
  184. package/lib/toArray.js +8 -19
  185. package/lib/traverseAllChildren.js +19 -82
  186. package/lib/update.js +25 -85
  187. package/lib/validateDOMNesting.js +264 -0
  188. package/lib/warning.js +17 -15
  189. package/package.json +3 -3
  190. package/lib/MobileSafariClickEventPlugin.js +0 -56
  191. package/lib/ReactPutListenerQueue.js +0 -54
  192. package/lib/cx.js +0 -52
  193. package/lib/getReactRootElementInContainer.js +0 -33
@@ -26,22 +26,22 @@ var ReactInstanceMap = {
26
26
  * transform these to strings for IE support. When this transform is fully
27
27
  * supported we can rename it.
28
28
  */
29
- remove: function(key) {
29
+ remove: function (key) {
30
30
  key._reactInternalInstance = undefined;
31
31
  },
32
32
 
33
- get: function(key) {
33
+ get: function (key) {
34
34
  return key._reactInternalInstance;
35
35
  },
36
36
 
37
- has: function(key) {
37
+ has: function (key) {
38
38
  return key._reactInternalInstance !== undefined;
39
39
  },
40
40
 
41
- set: function(key, value) {
41
+ set: function (key, value) {
42
42
  key._reactInternalInstance = value;
43
43
  }
44
44
 
45
45
  };
46
46
 
47
- module.exports = ReactInstanceMap;
47
+ module.exports = ReactInstanceMap;
@@ -32,4 +32,4 @@ var ReactLifeCycle = {
32
32
  currentlyUnmountingInstance: null
33
33
  };
34
34
 
35
- module.exports = ReactLifeCycle;
35
+ module.exports = ReactLifeCycle;
package/lib/ReactLink.js CHANGED
@@ -56,9 +56,7 @@ function ReactLink(value, requestChange) {
56
56
  */
57
57
  function createLinkTypeChecker(linkType) {
58
58
  var shapes = {
59
- value: typeof linkType === 'undefined' ?
60
- React.PropTypes.any.isRequired :
61
- linkType.isRequired,
59
+ value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired,
62
60
  requestChange: React.PropTypes.func.isRequired
63
61
  };
64
62
  return React.PropTypes.shape(shapes);
@@ -68,4 +66,4 @@ ReactLink.PropTypes = {
68
66
  link: createLinkTypeChecker
69
67
  };
70
68
 
71
- module.exports = ReactLink;
69
+ module.exports = ReactLink;
@@ -20,12 +20,9 @@ var ReactMarkupChecksum = {
20
20
  * @param {string} markup Markup string
21
21
  * @return {string} Markup string with checksum attribute attached
22
22
  */
23
- addChecksumToMarkup: function(markup) {
23
+ addChecksumToMarkup: function (markup) {
24
24
  var checksum = adler32(markup);
25
- return markup.replace(
26
- '>',
27
- ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
28
- );
25
+ return markup.replace('>', ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">');
29
26
  },
30
27
 
31
28
  /**
@@ -33,14 +30,12 @@ var ReactMarkupChecksum = {
33
30
  * @param {DOMElement} element root React element
34
31
  * @returns {boolean} whether or not the markup is the same
35
32
  */
36
- canReuseMarkup: function(markup, element) {
37
- var existingChecksum = element.getAttribute(
38
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
39
- );
33
+ canReuseMarkup: function (markup, element) {
34
+ var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
40
35
  existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
41
36
  var markupChecksum = adler32(markup);
42
37
  return markupChecksum === existingChecksum;
43
38
  }
44
39
  };
45
40
 
46
- module.exports = ReactMarkupChecksum;
41
+ module.exports = ReactMarkupChecksum;
package/lib/ReactMount.js CHANGED
@@ -27,11 +27,11 @@ var ReactUpdates = require("./ReactUpdates");
27
27
 
28
28
  var emptyObject = require("./emptyObject");
29
29
  var containsNode = require("./containsNode");
30
- var getReactRootElementInContainer = require("./getReactRootElementInContainer");
31
30
  var instantiateReactComponent = require("./instantiateReactComponent");
32
31
  var invariant = require("./invariant");
33
32
  var setInnerHTML = require("./setInnerHTML");
34
33
  var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
34
+ var validateDOMNesting = require("./validateDOMNesting");
35
35
  var warning = require("./warning");
36
36
 
37
37
  var SEPARATOR = ReactInstanceHandles.SEPARATOR;
@@ -41,6 +41,7 @@ var nodeCache = {};
41
41
 
42
42
  var ELEMENT_NODE_TYPE = 1;
43
43
  var DOC_NODE_TYPE = 9;
44
+ var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
44
45
 
45
46
  /** Mapping from reactRootID to React component instance. */
46
47
  var instancesByReactRootID = {};
@@ -48,7 +49,7 @@ var instancesByReactRootID = {};
48
49
  /** Mapping from reactRootID to `container` nodes. */
49
50
  var containersByReactRootID = {};
50
51
 
51
- if ("production" !== process.env.NODE_ENV) {
52
+ if ('production' !== process.env.NODE_ENV) {
52
53
  /** __DEV__-only mapping from reactRootID to root elements. */
53
54
  var rootElementsByReactRootID = {};
54
55
  }
@@ -72,6 +73,23 @@ function firstDifferenceIndex(string1, string2) {
72
73
  return string1.length === string2.length ? -1 : minLen;
73
74
  }
74
75
 
76
+ /**
77
+ * @param {DOMElement|DOMDocument} container DOM element that may contain
78
+ * a React component
79
+ * @return {?*} DOM element that may have the reactRoot ID, or null.
80
+ */
81
+ function getReactRootElementInContainer(container) {
82
+ if (!container) {
83
+ return null;
84
+ }
85
+
86
+ if (container.nodeType === DOC_NODE_TYPE) {
87
+ return container.documentElement;
88
+ } else {
89
+ return container.firstChild;
90
+ }
91
+ }
92
+
75
93
  /**
76
94
  * @param {DOMElement} container DOM element that may contain a React component.
77
95
  * @return {?string} A "reactRoot" ID, if a React component is rendered.
@@ -97,11 +115,7 @@ function getID(node) {
97
115
  if (nodeCache.hasOwnProperty(id)) {
98
116
  var cached = nodeCache[id];
99
117
  if (cached !== node) {
100
- ("production" !== process.env.NODE_ENV ? invariant(
101
- !isValid(cached, id),
102
- 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
103
- ATTR_NAME, id
104
- ) : invariant(!isValid(cached, id)));
118
+ 'production' !== process.env.NODE_ENV ? invariant(!isValid(cached, id), 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(!isValid(cached, id));
105
119
 
106
120
  nodeCache[id] = node;
107
121
  }
@@ -179,11 +193,7 @@ function getNodeFromInstance(instance) {
179
193
  */
180
194
  function isValid(node, id) {
181
195
  if (node) {
182
- ("production" !== process.env.NODE_ENV ? invariant(
183
- internalGetID(node) === id,
184
- 'ReactMount: Unexpected modification of `%s`',
185
- ATTR_NAME
186
- ) : invariant(internalGetID(node) === id));
196
+ 'production' !== process.env.NODE_ENV ? invariant(internalGetID(node) === id, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(internalGetID(node) === id);
187
197
 
188
198
  var container = ReactMount.findReactContainerForID(id);
189
199
  if (container && containsNode(container, node)) {
@@ -220,10 +230,7 @@ function findDeepestCachedAncestorImpl(ancestorID) {
220
230
  */
221
231
  function findDeepestCachedAncestor(targetID) {
222
232
  deepestNodeSoFar = null;
223
- ReactInstanceHandles.traverseAncestors(
224
- targetID,
225
- findDeepestCachedAncestorImpl
226
- );
233
+ ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
227
234
 
228
235
  var foundNode = deepestNodeSoFar;
229
236
  deepestNodeSoFar = null;
@@ -239,15 +246,14 @@ function findDeepestCachedAncestor(targetID) {
239
246
  * @param {ReactReconcileTransaction} transaction
240
247
  * @param {boolean} shouldReuseMarkup If true, do not insert markup
241
248
  */
242
- function mountComponentIntoNode(
243
- componentInstance,
244
- rootID,
245
- container,
246
- transaction,
247
- shouldReuseMarkup) {
248
- var markup = ReactReconciler.mountComponent(
249
- componentInstance, rootID, transaction, emptyObject
250
- );
249
+ function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
250
+ if ('production' !== process.env.NODE_ENV) {
251
+ if (context === emptyObject) {
252
+ context = {};
253
+ }
254
+ context[validateDOMNesting.tagStackContextKey] = [container.nodeName.toLowerCase()];
255
+ }
256
+ var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
251
257
  componentInstance._isTopLevel = true;
252
258
  ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
253
259
  }
@@ -260,24 +266,34 @@ function mountComponentIntoNode(
260
266
  * @param {DOMElement} container DOM element to mount into.
261
267
  * @param {boolean} shouldReuseMarkup If true, do not insert markup
262
268
  */
263
- function batchedMountComponentIntoNode(
264
- componentInstance,
265
- rootID,
266
- container,
267
- shouldReuseMarkup) {
269
+ function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
268
270
  var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
269
- transaction.perform(
270
- mountComponentIntoNode,
271
- null,
272
- componentInstance,
273
- rootID,
274
- container,
275
- transaction,
276
- shouldReuseMarkup
277
- );
271
+ transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
278
272
  ReactUpdates.ReactReconcileTransaction.release(transaction);
279
273
  }
280
274
 
275
+ /**
276
+ * Unmounts a component and removes it from the DOM.
277
+ *
278
+ * @param {ReactComponent} instance React component instance.
279
+ * @param {DOMElement} container DOM element to unmount from.
280
+ * @final
281
+ * @internal
282
+ * @see {ReactMount.unmountComponentAtNode}
283
+ */
284
+ function unmountComponentFromNode(instance, container) {
285
+ ReactReconciler.unmountComponent(instance);
286
+
287
+ if (container.nodeType === DOC_NODE_TYPE) {
288
+ container = container.documentElement;
289
+ }
290
+
291
+ // http://jsperf.com/emptying-a-node
292
+ while (container.lastChild) {
293
+ container.removeChild(container.lastChild);
294
+ }
295
+ }
296
+
281
297
  /**
282
298
  * Mounting is the process of initializing a React component by creating its
283
299
  * representative DOM elements and inserting them into a supplied `container`.
@@ -308,7 +324,7 @@ var ReactMount = {
308
324
  * @param {DOMElement} container The `container` being rendered into.
309
325
  * @param {function} renderCallback This must be called once to do the render.
310
326
  */
311
- scrollMonitor: function(container, renderCallback) {
327
+ scrollMonitor: function (container, renderCallback) {
312
328
  renderCallback();
313
329
  },
314
330
 
@@ -319,26 +335,21 @@ var ReactMount = {
319
335
  * @param {DOMElement} container container to render into
320
336
  * @param {?function} callback function triggered on completion
321
337
  */
322
- _updateRootComponent: function(
323
- prevComponent,
324
- nextElement,
325
- container,
326
- callback) {
327
- if ("production" !== process.env.NODE_ENV) {
338
+ _updateRootComponent: function (prevComponent, nextElement, container, callback) {
339
+ if ('production' !== process.env.NODE_ENV) {
328
340
  ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
329
341
  }
330
342
 
331
- ReactMount.scrollMonitor(container, function() {
343
+ ReactMount.scrollMonitor(container, function () {
332
344
  ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
333
345
  if (callback) {
334
346
  ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
335
347
  }
336
348
  });
337
349
 
338
- if ("production" !== process.env.NODE_ENV) {
350
+ if ('production' !== process.env.NODE_ENV) {
339
351
  // Record the root element in case it later gets transplanted.
340
- rootElementsByReactRootID[getReactRootID(container)] =
341
- getReactRootElementInContainer(container);
352
+ rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
342
353
  }
343
354
 
344
355
  return prevComponent;
@@ -351,15 +362,8 @@ var ReactMount = {
351
362
  * @param {DOMElement} container container to render into
352
363
  * @return {string} reactRoot ID prefix
353
364
  */
354
- _registerComponent: function(nextComponent, container) {
355
- ("production" !== process.env.NODE_ENV ? invariant(
356
- container && (
357
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
358
- ),
359
- '_registerComponent(...): Target container is not a DOM element.'
360
- ) : invariant(container && (
361
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
362
- )));
365
+ _registerComponent: function (nextComponent, container) {
366
+ 'production' !== process.env.NODE_ENV ? invariant(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE), '_registerComponent(...): Target container is not a DOM element.') : invariant(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
363
367
 
364
368
  ReactBrowserEventEmitter.ensureScrollValueMonitoring();
365
369
 
@@ -375,44 +379,24 @@ var ReactMount = {
375
379
  * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
376
380
  * @return {ReactComponent} nextComponent
377
381
  */
378
- _renderNewRootComponent: function(
379
- nextElement,
380
- container,
381
- shouldReuseMarkup
382
- ) {
382
+ _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
383
383
  // Various parts of our code (such as ReactCompositeComponent's
384
384
  // _renderValidatedComponent) assume that calls to render aren't nested;
385
385
  // verify that that's the case.
386
- ("production" !== process.env.NODE_ENV ? warning(
387
- ReactCurrentOwner.current == null,
388
- '_renderNewRootComponent(): Render methods should be a pure function ' +
389
- 'of props and state; triggering nested component updates from ' +
390
- 'render is not allowed. If necessary, trigger nested updates in ' +
391
- 'componentDidUpdate.'
392
- ) : null);
386
+ 'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : null;
393
387
 
394
388
  var componentInstance = instantiateReactComponent(nextElement, null);
395
- var reactRootID = ReactMount._registerComponent(
396
- componentInstance,
397
- container
398
- );
389
+ var reactRootID = ReactMount._registerComponent(componentInstance, container);
399
390
 
400
391
  // The initial render is synchronous but any updates that happen during
401
392
  // rendering, in componentWillMount or componentDidMount, will be batched
402
393
  // according to the current batching strategy.
403
394
 
404
- ReactUpdates.batchedUpdates(
405
- batchedMountComponentIntoNode,
406
- componentInstance,
407
- reactRootID,
408
- container,
409
- shouldReuseMarkup
410
- );
395
+ ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
411
396
 
412
- if ("production" !== process.env.NODE_ENV) {
397
+ if ('production' !== process.env.NODE_ENV) {
413
398
  // Record the root element in case it later gets transplanted.
414
- rootElementsByReactRootID[reactRootID] =
415
- getReactRootElementInContainer(container);
399
+ rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
416
400
  }
417
401
 
418
402
  return componentInstance;
@@ -425,61 +409,44 @@ var ReactMount = {
425
409
  * perform an update on it and only mutate the DOM as necessary to reflect the
426
410
  * latest React component.
427
411
  *
412
+ * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
428
413
  * @param {ReactElement} nextElement Component element to render.
429
414
  * @param {DOMElement} container DOM element to render into.
430
415
  * @param {?function} callback function triggered on completion
431
416
  * @return {ReactComponent} Component instance rendered in `container`.
432
417
  */
433
- render: function(nextElement, container, callback) {
434
- ("production" !== process.env.NODE_ENV ? invariant(
435
- ReactElement.isValidElement(nextElement),
436
- 'React.render(): Invalid component element.%s',
437
- (
438
- typeof nextElement === 'string' ?
439
- ' Instead of passing an element string, make sure to instantiate ' +
440
- 'it by passing it to React.createElement.' :
441
- typeof nextElement === 'function' ?
442
- ' Instead of passing a component class, make sure to instantiate ' +
443
- 'it by passing it to React.createElement.' :
444
- // Check if it quacks like an element
445
- nextElement != null && nextElement.props !== undefined ?
446
- ' This may be caused by unintentionally loading two independent ' +
447
- 'copies of React.' :
448
- ''
449
- )
450
- ) : invariant(ReactElement.isValidElement(nextElement)));
418
+ renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
419
+ 'production' !== process.env.NODE_ENV ? invariant(parentComponent != null && parentComponent._reactInternalInstance != null, 'parentComponent must be a valid React Component') : invariant(parentComponent != null && parentComponent._reactInternalInstance != null);
420
+ return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
421
+ },
422
+
423
+ _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
424
+ 'production' !== process.env.NODE_ENV ? invariant(ReactElement.isValidElement(nextElement), 'React.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
425
+ // Check if it quacks like an element
426
+ nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(ReactElement.isValidElement(nextElement));
427
+
428
+ 'production' !== process.env.NODE_ENV ? warning(container && container.tagName !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : null;
451
429
 
452
430
  var prevComponent = instancesByReactRootID[getReactRootID(container)];
453
431
 
454
432
  if (prevComponent) {
455
433
  var prevElement = prevComponent._currentElement;
456
434
  if (shouldUpdateReactComponent(prevElement, nextElement)) {
457
- return ReactMount._updateRootComponent(
458
- prevComponent,
459
- nextElement,
460
- container,
461
- callback
462
- ).getPublicInstance();
435
+ return ReactMount._updateRootComponent(prevComponent, nextElement, container, callback).getPublicInstance();
463
436
  } else {
464
437
  ReactMount.unmountComponentAtNode(container);
465
438
  }
466
439
  }
467
440
 
468
441
  var reactRootElement = getReactRootElementInContainer(container);
469
- var containerHasReactMarkup =
470
- reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
442
+ var containerHasReactMarkup = reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
471
443
 
472
- if ("production" !== process.env.NODE_ENV) {
444
+ if ('production' !== process.env.NODE_ENV) {
473
445
  if (!containerHasReactMarkup || reactRootElement.nextSibling) {
474
446
  var rootElementSibling = reactRootElement;
475
447
  while (rootElementSibling) {
476
448
  if (ReactMount.isRenderedByReact(rootElementSibling)) {
477
- ("production" !== process.env.NODE_ENV ? warning(
478
- false,
479
- 'render(): Target node has markup rendered by React, but there ' +
480
- 'are unrelated nodes as well. This is most commonly caused by ' +
481
- 'white-space inserted around server-rendered markup.'
482
- ) : null);
449
+ 'production' !== process.env.NODE_ENV ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : null;
483
450
  break;
484
451
  }
485
452
 
@@ -489,18 +456,29 @@ var ReactMount = {
489
456
  }
490
457
 
491
458
  var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
492
-
493
- var component = ReactMount._renderNewRootComponent(
494
- nextElement,
495
- container,
496
- shouldReuseMarkup
497
- ).getPublicInstance();
459
+ var component = ReactMount._renderNewRootComponent(nextElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject).getPublicInstance();
498
460
  if (callback) {
499
461
  callback.call(component);
500
462
  }
501
463
  return component;
502
464
  },
503
465
 
466
+ /**
467
+ * Renders a React component into the DOM in the supplied `container`.
468
+ *
469
+ * If the React component was previously rendered into `container`, this will
470
+ * perform an update on it and only mutate the DOM as necessary to reflect the
471
+ * latest React component.
472
+ *
473
+ * @param {ReactElement} nextElement Component element to render.
474
+ * @param {DOMElement} container DOM element to render into.
475
+ * @param {?function} callback function triggered on completion
476
+ * @return {ReactComponent} Component instance rendered in `container`.
477
+ */
478
+ render: function (nextElement, container, callback) {
479
+ return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
480
+ },
481
+
504
482
  /**
505
483
  * Constructs a component instance of `constructor` with `initialProps` and
506
484
  * renders it into the supplied `container`.
@@ -510,7 +488,7 @@ var ReactMount = {
510
488
  * @param {DOMElement} container DOM element to render into.
511
489
  * @return {ReactComponent} Component instance rendered in `container`.
512
490
  */
513
- constructAndRenderComponent: function(constructor, props, container) {
491
+ constructAndRenderComponent: function (constructor, props, container) {
514
492
  var element = ReactElement.createElement(constructor, props);
515
493
  return ReactMount.render(element, container);
516
494
  },
@@ -524,13 +502,9 @@ var ReactMount = {
524
502
  * @param {string} id ID of the DOM element to render into.
525
503
  * @return {ReactComponent} Component instance rendered in the container node.
526
504
  */
527
- constructAndRenderComponentByID: function(constructor, props, id) {
505
+ constructAndRenderComponentByID: function (constructor, props, id) {
528
506
  var domNode = document.getElementById(id);
529
- ("production" !== process.env.NODE_ENV ? invariant(
530
- domNode,
531
- 'Tried to get element with id of "%s" but it is not present on the page.',
532
- id
533
- ) : invariant(domNode));
507
+ 'production' !== process.env.NODE_ENV ? invariant(domNode, 'Tried to get element with id of "%s" but it is not present on the page.', id) : invariant(domNode);
534
508
  return ReactMount.constructAndRenderComponent(constructor, props, domNode);
535
509
  },
536
510
 
@@ -542,7 +516,7 @@ var ReactMount = {
542
516
  * @param {DOMElement} container DOM element to register as a container.
543
517
  * @return {string} The "reactRoot" ID of elements rendered within.
544
518
  */
545
- registerContainer: function(container) {
519
+ registerContainer: function (container) {
546
520
  var reactRootID = getReactRootID(container);
547
521
  if (reactRootID) {
548
522
  // If one exists, make sure it is a valid "reactRoot" ID.
@@ -563,64 +537,29 @@ var ReactMount = {
563
537
  * @return {boolean} True if a component was found in and unmounted from
564
538
  * `container`
565
539
  */
566
- unmountComponentAtNode: function(container) {
540
+ unmountComponentAtNode: function (container) {
567
541
  // Various parts of our code (such as ReactCompositeComponent's
568
542
  // _renderValidatedComponent) assume that calls to render aren't nested;
569
543
  // verify that that's the case. (Strictly speaking, unmounting won't cause a
570
544
  // render but we still don't expect to be in a render call here.)
571
- ("production" !== process.env.NODE_ENV ? warning(
572
- ReactCurrentOwner.current == null,
573
- 'unmountComponentAtNode(): Render methods should be a pure function of ' +
574
- 'props and state; triggering nested component updates from render is ' +
575
- 'not allowed. If necessary, trigger nested updates in ' +
576
- 'componentDidUpdate.'
577
- ) : null);
578
-
579
- ("production" !== process.env.NODE_ENV ? invariant(
580
- container && (
581
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
582
- ),
583
- 'unmountComponentAtNode(...): Target container is not a DOM element.'
584
- ) : invariant(container && (
585
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
586
- )));
545
+ 'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : null;
546
+
547
+ 'production' !== process.env.NODE_ENV ? invariant(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE), 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
587
548
 
588
549
  var reactRootID = getReactRootID(container);
589
550
  var component = instancesByReactRootID[reactRootID];
590
551
  if (!component) {
591
552
  return false;
592
553
  }
593
- ReactMount.unmountComponentFromNode(component, container);
554
+ ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
594
555
  delete instancesByReactRootID[reactRootID];
595
556
  delete containersByReactRootID[reactRootID];
596
- if ("production" !== process.env.NODE_ENV) {
557
+ if ('production' !== process.env.NODE_ENV) {
597
558
  delete rootElementsByReactRootID[reactRootID];
598
559
  }
599
560
  return true;
600
561
  },
601
562
 
602
- /**
603
- * Unmounts a component and removes it from the DOM.
604
- *
605
- * @param {ReactComponent} instance React component instance.
606
- * @param {DOMElement} container DOM element to unmount from.
607
- * @final
608
- * @internal
609
- * @see {ReactMount.unmountComponentAtNode}
610
- */
611
- unmountComponentFromNode: function(instance, container) {
612
- ReactReconciler.unmountComponent(instance);
613
-
614
- if (container.nodeType === DOC_NODE_TYPE) {
615
- container = container.documentElement;
616
- }
617
-
618
- // http://jsperf.com/emptying-a-node
619
- while (container.lastChild) {
620
- container.removeChild(container.lastChild);
621
- }
622
- },
623
-
624
563
  /**
625
564
  * Finds the container DOM element that contains React component to which the
626
565
  * supplied DOM `id` belongs.
@@ -628,36 +567,26 @@ var ReactMount = {
628
567
  * @param {string} id The ID of an element rendered by a React component.
629
568
  * @return {?DOMElement} DOM element that contains the `id`.
630
569
  */
631
- findReactContainerForID: function(id) {
570
+ findReactContainerForID: function (id) {
632
571
  var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
633
572
  var container = containersByReactRootID[reactRootID];
634
573
 
635
- if ("production" !== process.env.NODE_ENV) {
574
+ if ('production' !== process.env.NODE_ENV) {
636
575
  var rootElement = rootElementsByReactRootID[reactRootID];
637
576
  if (rootElement && rootElement.parentNode !== container) {
638
- ("production" !== process.env.NODE_ENV ? invariant(
639
- // Call internalGetID here because getID calls isValid which calls
640
- // findReactContainerForID (this function).
641
- internalGetID(rootElement) === reactRootID,
642
- 'ReactMount: Root element ID differed from reactRootID.'
643
- ) : invariant(// Call internalGetID here because getID calls isValid which calls
577
+ 'production' !== process.env.NODE_ENV ? warning(
578
+ // Call internalGetID here because getID calls isValid which calls
644
579
  // findReactContainerForID (this function).
645
- internalGetID(rootElement) === reactRootID));
646
-
580
+ internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : null;
647
581
  var containerChild = container.firstChild;
648
- if (containerChild &&
649
- reactRootID === internalGetID(containerChild)) {
582
+ if (containerChild && reactRootID === internalGetID(containerChild)) {
650
583
  // If the container has a new child with the same ID as the old
651
584
  // root element, then rootElementsByReactRootID[reactRootID] is
652
585
  // just stale and needs to be updated. The case that deserves a
653
586
  // warning is when the container is empty.
654
587
  rootElementsByReactRootID[reactRootID] = containerChild;
655
588
  } else {
656
- ("production" !== process.env.NODE_ENV ? warning(
657
- false,
658
- 'ReactMount: Root element has been removed from its original ' +
659
- 'container. New container:', rootElement.parentNode
660
- ) : null);
589
+ 'production' !== process.env.NODE_ENV ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container:', rootElement.parentNode) : null;
661
590
  }
662
591
  }
663
592
  }
@@ -671,7 +600,7 @@ var ReactMount = {
671
600
  * @param {string} id ID of a DOM node in the React component.
672
601
  * @return {DOMElement} Root DOM node of the React component.
673
602
  */
674
- findReactNodeByID: function(id) {
603
+ findReactNodeByID: function (id) {
675
604
  var reactRoot = ReactMount.findReactContainerForID(id);
676
605
  return ReactMount.findComponentRoot(reactRoot, id);
677
606
  },
@@ -683,7 +612,7 @@ var ReactMount = {
683
612
  * @return {boolean} True if the DOM Element appears to be rendered by React.
684
613
  * @internal
685
614
  */
686
- isRenderedByReact: function(node) {
615
+ isRenderedByReact: function (node) {
687
616
  if (node.nodeType !== 1) {
688
617
  // Not a DOMElement, therefore not a React component
689
618
  return false;
@@ -700,7 +629,7 @@ var ReactMount = {
700
629
  * @return {?DOMEventTarget}
701
630
  * @internal
702
631
  */
703
- getFirstReactDOM: function(node) {
632
+ getFirstReactDOM: function (node) {
704
633
  var current = node;
705
634
  while (current && current.parentNode !== current) {
706
635
  if (ReactMount.isRenderedByReact(current)) {
@@ -721,7 +650,7 @@ var ReactMount = {
721
650
  * @return {DOMEventTarget} DOM node with the supplied `targetID`.
722
651
  * @internal
723
652
  */
724
- findComponentRoot: function(ancestorNode, targetID) {
653
+ findComponentRoot: function (ancestorNode, targetID) {
725
654
  var firstChildren = findComponentRootReusableArray;
726
655
  var childIndex = 0;
727
656
 
@@ -752,7 +681,6 @@ var ReactMount = {
752
681
  firstChildren.length = childIndex = 0;
753
682
  firstChildren.push(child.firstChild);
754
683
  }
755
-
756
684
  } else {
757
685
  // If this child had no ID, then there's a chance that it was
758
686
  // injected automatically by the browser, as when a `<table>`
@@ -777,87 +705,35 @@ var ReactMount = {
777
705
 
778
706
  firstChildren.length = 0;
779
707
 
780
- ("production" !== process.env.NODE_ENV ? invariant(
781
- false,
782
- 'findComponentRoot(..., %s): Unable to find element. This probably ' +
783
- 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
784
- 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
785
- 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
786
- 'parent. ' +
787
- 'Try inspecting the child nodes of the element with React ID `%s`.',
788
- targetID,
789
- ReactMount.getID(ancestorNode)
790
- ) : invariant(false));
708
+ 'production' !== process.env.NODE_ENV ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false);
791
709
  },
792
710
 
793
- _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
794
- ("production" !== process.env.NODE_ENV ? invariant(
795
- container && (
796
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
797
- ),
798
- 'mountComponentIntoNode(...): Target container is not valid.'
799
- ) : invariant(container && (
800
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
801
- )));
711
+ _mountImageIntoNode: function (markup, container, shouldReuseMarkup) {
712
+ 'production' !== process.env.NODE_ENV ? invariant(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE), 'mountComponentIntoNode(...): Target container is not valid.') : invariant(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
802
713
 
803
714
  if (shouldReuseMarkup) {
804
715
  var rootElement = getReactRootElementInContainer(container);
805
716
  if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
806
717
  return;
807
718
  } else {
808
- var checksum = rootElement.getAttribute(
809
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
810
- );
719
+ var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
811
720
  rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
812
721
 
813
722
  var rootMarkup = rootElement.outerHTML;
814
- rootElement.setAttribute(
815
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
816
- checksum
817
- );
723
+ rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
818
724
 
819
725
  var diffIndex = firstDifferenceIndex(markup, rootMarkup);
820
- var difference = ' (client) ' +
821
- markup.substring(diffIndex - 20, diffIndex + 20) +
822
- '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
823
-
824
- ("production" !== process.env.NODE_ENV ? invariant(
825
- container.nodeType !== DOC_NODE_TYPE,
826
- 'You\'re trying to render a component to the document using ' +
827
- 'server rendering but the checksum was invalid. This usually ' +
828
- 'means you rendered a different component type or props on ' +
829
- 'the client from the one on the server, or your render() ' +
830
- 'methods are impure. React cannot handle this case due to ' +
831
- 'cross-browser quirks by rendering at the document root. You ' +
832
- 'should look for environment dependent code in your components ' +
833
- 'and ensure the props are the same client and server side:\n%s',
834
- difference
835
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
836
-
837
- if ("production" !== process.env.NODE_ENV) {
838
- ("production" !== process.env.NODE_ENV ? warning(
839
- false,
840
- 'React attempted to reuse markup in a container but the ' +
841
- 'checksum was invalid. This generally means that you are ' +
842
- 'using server rendering and the markup generated on the ' +
843
- 'server was not what the client was expecting. React injected ' +
844
- 'new markup to compensate which works but you have lost many ' +
845
- 'of the benefits of server rendering. Instead, figure out ' +
846
- 'why the markup being generated is different on the client ' +
847
- 'or server:\n%s',
848
- difference
849
- ) : null);
726
+ var difference = ' (client) ' + markup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
727
+
728
+ 'production' !== process.env.NODE_ENV ? invariant(container.nodeType !== DOC_NODE_TYPE, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(container.nodeType !== DOC_NODE_TYPE);
729
+
730
+ if ('production' !== process.env.NODE_ENV) {
731
+ 'production' !== process.env.NODE_ENV ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : null;
850
732
  }
851
733
  }
852
734
  }
853
735
 
854
- ("production" !== process.env.NODE_ENV ? invariant(
855
- container.nodeType !== DOC_NODE_TYPE,
856
- 'You\'re trying to render a component to the document but ' +
857
- 'you didn\'t use server rendering. We can\'t do this ' +
858
- 'without using server rendering due to cross-browser quirks. ' +
859
- 'See React.renderToString() for server rendering.'
860
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
736
+ 'production' !== process.env.NODE_ENV ? invariant(container.nodeType !== DOC_NODE_TYPE, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See React.renderToString() for server rendering.') : invariant(container.nodeType !== DOC_NODE_TYPE);
861
737
 
862
738
  setInnerHTML(container, markup);
863
739
  },
@@ -884,4 +760,4 @@ ReactPerf.measureMethods(ReactMount, 'ReactMount', {
884
760
  _mountImageIntoNode: '_mountImageIntoNode'
885
761
  });
886
762
 
887
- module.exports = ReactMount;
763
+ module.exports = ReactMount;