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
package/lib/ReactLink.js CHANGED
@@ -35,7 +35,7 @@
35
35
  * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
36
36
  */
37
37
 
38
- var React = require("./React");
38
+ var React = require('./React');
39
39
 
40
40
  /**
41
41
  * @param {*} value current value of the link
@@ -11,7 +11,9 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var adler32 = require("./adler32");
14
+ var adler32 = require('./adler32');
15
+
16
+ var TAG_END = /\/?>/;
15
17
 
16
18
  var ReactMarkupChecksum = {
17
19
  CHECKSUM_ATTR_NAME: 'data-react-checksum',
@@ -22,7 +24,9 @@ var ReactMarkupChecksum = {
22
24
  */
23
25
  addChecksumToMarkup: function (markup) {
24
26
  var checksum = adler32(markup);
25
- return markup.replace('>', ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">');
27
+
28
+ // Add checksum (handle both parent tags and self-closing tags)
29
+ return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
26
30
  },
27
31
 
28
32
  /**
package/lib/ReactMount.js CHANGED
@@ -11,27 +11,27 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var DOMProperty = require("./DOMProperty");
15
- var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
16
- var ReactCurrentOwner = require("./ReactCurrentOwner");
17
- var ReactElement = require("./ReactElement");
18
- var ReactEmptyComponent = require("./ReactEmptyComponent");
19
- var ReactInstanceHandles = require("./ReactInstanceHandles");
20
- var ReactInstanceMap = require("./ReactInstanceMap");
21
- var ReactMarkupChecksum = require("./ReactMarkupChecksum");
22
- var ReactPerf = require("./ReactPerf");
23
- var ReactReconciler = require("./ReactReconciler");
24
- var ReactUpdateQueue = require("./ReactUpdateQueue");
25
- var ReactUpdates = require("./ReactUpdates");
26
-
27
- var emptyObject = require("./emptyObject");
28
- var containsNode = require("./containsNode");
29
- var instantiateReactComponent = require("./instantiateReactComponent");
30
- var invariant = require("./invariant");
31
- var setInnerHTML = require("./setInnerHTML");
32
- var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
33
- var validateDOMNesting = require("./validateDOMNesting");
34
- var warning = require("./warning");
14
+ var DOMProperty = require('./DOMProperty');
15
+ var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
16
+ var ReactCurrentOwner = require('./ReactCurrentOwner');
17
+ var ReactElement = require('./ReactElement');
18
+ var ReactEmptyComponent = require('./ReactEmptyComponent');
19
+ var ReactInstanceHandles = require('./ReactInstanceHandles');
20
+ var ReactInstanceMap = require('./ReactInstanceMap');
21
+ var ReactMarkupChecksum = require('./ReactMarkupChecksum');
22
+ var ReactPerf = require('./ReactPerf');
23
+ var ReactReconciler = require('./ReactReconciler');
24
+ var ReactUpdateQueue = require('./ReactUpdateQueue');
25
+ var ReactUpdates = require('./ReactUpdates');
26
+
27
+ var emptyObject = require('fbjs/lib/emptyObject');
28
+ var containsNode = require('fbjs/lib/containsNode');
29
+ var instantiateReactComponent = require('./instantiateReactComponent');
30
+ var invariant = require('fbjs/lib/invariant');
31
+ var setInnerHTML = require('./setInnerHTML');
32
+ var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
33
+ var validateDOMNesting = require('./validateDOMNesting');
34
+ var warning = require('fbjs/lib/warning');
35
35
 
36
36
  var SEPARATOR = ReactInstanceHandles.SEPARATOR;
37
37
 
@@ -48,7 +48,7 @@ var instancesByReactRootID = {};
48
48
  /** Mapping from reactRootID to `container` nodes. */
49
49
  var containersByReactRootID = {};
50
50
 
51
- if ('production' !== process.env.NODE_ENV) {
51
+ if (process.env.NODE_ENV !== 'production') {
52
52
  /** __DEV__-only mapping from reactRootID to root elements. */
53
53
  var rootElementsByReactRootID = {};
54
54
  }
@@ -114,7 +114,7 @@ function getID(node) {
114
114
  if (nodeCache.hasOwnProperty(id)) {
115
115
  var cached = nodeCache[id];
116
116
  if (cached !== node) {
117
- !!isValid(cached, id) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
117
+ !!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
118
118
 
119
119
  nodeCache[id] = node;
120
120
  }
@@ -192,7 +192,7 @@ function getNodeFromInstance(instance) {
192
192
  */
193
193
  function isValid(node, id) {
194
194
  if (node) {
195
- !(internalGetID(node) === id) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
195
+ !(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
196
196
 
197
197
  var container = ReactMount.findReactContainerForID(id);
198
198
  if (container && containsNode(container, node)) {
@@ -246,7 +246,7 @@ function findDeepestCachedAncestor(targetID) {
246
246
  * @param {boolean} shouldReuseMarkup If true, do not insert markup
247
247
  */
248
248
  function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
249
- if ('production' !== process.env.NODE_ENV) {
249
+ if (process.env.NODE_ENV !== 'production') {
250
250
  if (context === emptyObject) {
251
251
  context = {};
252
252
  }
@@ -354,7 +354,7 @@ var ReactMount = {
354
354
  }
355
355
  });
356
356
 
357
- if ('production' !== process.env.NODE_ENV) {
357
+ if (process.env.NODE_ENV !== 'production') {
358
358
  // Record the root element in case it later gets transplanted.
359
359
  rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
360
360
  }
@@ -370,7 +370,7 @@ var ReactMount = {
370
370
  * @return {string} reactRoot ID prefix
371
371
  */
372
372
  _registerComponent: function (nextComponent, container) {
373
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? 'production' !== process.env.NODE_ENV ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
373
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
374
374
 
375
375
  ReactBrowserEventEmitter.ensureScrollValueMonitoring();
376
376
 
@@ -390,7 +390,7 @@ var ReactMount = {
390
390
  // Various parts of our code (such as ReactCompositeComponent's
391
391
  // _renderValidatedComponent) assume that calls to render aren't nested;
392
392
  // verify that that's the case.
393
- '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') : undefined;
393
+ process.env.NODE_ENV !== 'production' ? 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') : undefined;
394
394
 
395
395
  var componentInstance = instantiateReactComponent(nextElement, null);
396
396
  var reactRootID = ReactMount._registerComponent(componentInstance, container);
@@ -401,7 +401,7 @@ var ReactMount = {
401
401
 
402
402
  ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
403
403
 
404
- if ('production' !== process.env.NODE_ENV) {
404
+ if (process.env.NODE_ENV !== 'production') {
405
405
  // Record the root element in case it later gets transplanted.
406
406
  rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
407
407
  }
@@ -423,16 +423,16 @@ var ReactMount = {
423
423
  * @return {ReactComponent} Component instance rendered in `container`.
424
424
  */
425
425
  renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
426
- !(parentComponent != null && parentComponent._reactInternalInstance != null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
426
+ !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
427
427
  return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
428
428
  },
429
429
 
430
430
  _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
431
- !ReactElement.isValidElement(nextElement) ? 'production' !== process.env.NODE_ENV ? invariant(false, '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.' :
431
+ !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, '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.' :
432
432
  // Check if it quacks like an element
433
433
  nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
434
434
 
435
- 'production' !== process.env.NODE_ENV ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== '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.') : undefined;
435
+ process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== '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.') : undefined;
436
436
 
437
437
  var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, nextElement);
438
438
 
@@ -451,12 +451,12 @@ var ReactMount = {
451
451
  var reactRootElement = getReactRootElementInContainer(container);
452
452
  var containerHasReactMarkup = reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
453
453
 
454
- if ('production' !== process.env.NODE_ENV) {
454
+ if (process.env.NODE_ENV !== 'production') {
455
455
  if (!containerHasReactMarkup || reactRootElement.nextSibling) {
456
456
  var rootElementSibling = reactRootElement;
457
457
  while (rootElementSibling) {
458
458
  if (ReactMount.isRenderedByReact(rootElementSibling)) {
459
- '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.') : undefined;
459
+ process.env.NODE_ENV !== 'production' ? 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.') : undefined;
460
460
  break;
461
461
  }
462
462
 
@@ -523,9 +523,9 @@ var ReactMount = {
523
523
  // _renderValidatedComponent) assume that calls to render aren't nested;
524
524
  // verify that that's the case. (Strictly speaking, unmounting won't cause a
525
525
  // render but we still don't expect to be in a render call here.)
526
- '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') : undefined;
526
+ process.env.NODE_ENV !== 'production' ? 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') : undefined;
527
527
 
528
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
528
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
529
529
 
530
530
  var reactRootID = getReactRootID(container);
531
531
  var component = instancesByReactRootID[reactRootID];
@@ -535,7 +535,7 @@ var ReactMount = {
535
535
  ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
536
536
  delete instancesByReactRootID[reactRootID];
537
537
  delete containersByReactRootID[reactRootID];
538
- if ('production' !== process.env.NODE_ENV) {
538
+ if (process.env.NODE_ENV !== 'production') {
539
539
  delete rootElementsByReactRootID[reactRootID];
540
540
  }
541
541
  return true;
@@ -552,10 +552,10 @@ var ReactMount = {
552
552
  var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
553
553
  var container = containersByReactRootID[reactRootID];
554
554
 
555
- if ('production' !== process.env.NODE_ENV) {
555
+ if (process.env.NODE_ENV !== 'production') {
556
556
  var rootElement = rootElementsByReactRootID[reactRootID];
557
557
  if (rootElement && rootElement.parentNode !== container) {
558
- 'production' !== process.env.NODE_ENV ? warning(
558
+ process.env.NODE_ENV !== 'production' ? warning(
559
559
  // Call internalGetID here because getID calls isValid which calls
560
560
  // findReactContainerForID (this function).
561
561
  internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
@@ -567,7 +567,7 @@ var ReactMount = {
567
567
  // warning is when the container is empty.
568
568
  rootElementsByReactRootID[reactRootID] = containerChild;
569
569
  } else {
570
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
570
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
571
571
  }
572
572
  }
573
573
  }
@@ -686,11 +686,11 @@ var ReactMount = {
686
686
 
687
687
  firstChildren.length = 0;
688
688
 
689
- !false ? '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) : undefined;
689
+ !false ? process.env.NODE_ENV !== 'production' ? 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) : undefined;
690
690
  },
691
691
 
692
692
  _mountImageIntoNode: function (markup, container, shouldReuseMarkup) {
693
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
693
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
694
694
 
695
695
  if (shouldReuseMarkup) {
696
696
  var rootElement = getReactRootElementInContainer(container);
@@ -703,18 +703,38 @@ var ReactMount = {
703
703
  var rootMarkup = rootElement.outerHTML;
704
704
  rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
705
705
 
706
- var diffIndex = firstDifferenceIndex(markup, rootMarkup);
707
- var difference = ' (client) ' + markup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
706
+ var normalizedMarkup = markup;
707
+ if (process.env.NODE_ENV !== 'production') {
708
+ // because rootMarkup is retrieved from the DOM, various normalizations
709
+ // will have occurred which will not be present in `markup`. Here,
710
+ // insert markup into a <div> or <iframe> depending on the container
711
+ // type to perform the same normalizations before comparing.
712
+ var normalizer;
713
+ if (container.nodeType === ELEMENT_NODE_TYPE) {
714
+ normalizer = document.createElement('div');
715
+ normalizer.innerHTML = markup;
716
+ normalizedMarkup = normalizer.innerHTML;
717
+ } else {
718
+ normalizer = document.createElement('iframe');
719
+ document.body.appendChild(normalizer);
720
+ normalizer.contentDocument.write(markup);
721
+ normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
722
+ document.body.removeChild(normalizer);
723
+ }
724
+ }
725
+
726
+ var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
727
+ var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
708
728
 
709
- !(container.nodeType !== DOC_NODE_TYPE) ? 'production' !== process.env.NODE_ENV ? invariant(false, '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(false) : undefined;
729
+ !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, '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(false) : undefined;
710
730
 
711
- if ('production' !== process.env.NODE_ENV) {
712
- '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) : undefined;
731
+ if (process.env.NODE_ENV !== 'production') {
732
+ process.env.NODE_ENV !== 'production' ? 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) : undefined;
713
733
  }
714
734
  }
715
735
  }
716
736
 
717
- !(container.nodeType !== DOC_NODE_TYPE) ? 'production' !== process.env.NODE_ENV ? invariant(false, '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(false) : undefined;
737
+ !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, '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(false) : undefined;
718
738
 
719
739
  setInnerHTML(container, markup);
720
740
  },
@@ -12,11 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var ReactComponentEnvironment = require("./ReactComponentEnvironment");
16
- var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
15
+ var ReactComponentEnvironment = require('./ReactComponentEnvironment');
16
+ var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
17
17
 
18
- var ReactReconciler = require("./ReactReconciler");
19
- var ReactChildReconciler = require("./ReactChildReconciler");
18
+ var ReactReconciler = require('./ReactReconciler');
19
+ var ReactChildReconciler = require('./ReactChildReconciler');
20
20
 
21
21
  /**
22
22
  * Updating children of a component may trigger recursive updates. The depth is
@@ -53,14 +53,14 @@ var markupQueue = [];
53
53
  * @param {number} toIndex Destination index.
54
54
  * @private
55
55
  */
56
- function enqueueMarkup(parentID, markup, toIndex) {
56
+ function enqueueInsertMarkup(parentID, markup, toIndex) {
57
57
  // NOTE: Null values reduce hidden classes.
58
58
  updateQueue.push({
59
59
  parentID: parentID,
60
60
  parentNode: null,
61
61
  type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
62
62
  markupIndex: markupQueue.push(markup) - 1,
63
- textContent: null,
63
+ content: null,
64
64
  fromIndex: null,
65
65
  toIndex: toIndex
66
66
  });
@@ -81,7 +81,7 @@ function enqueueMove(parentID, fromIndex, toIndex) {
81
81
  parentNode: null,
82
82
  type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
83
83
  markupIndex: null,
84
- textContent: null,
84
+ content: null,
85
85
  fromIndex: fromIndex,
86
86
  toIndex: toIndex
87
87
  });
@@ -101,12 +101,32 @@ function enqueueRemove(parentID, fromIndex) {
101
101
  parentNode: null,
102
102
  type: ReactMultiChildUpdateTypes.REMOVE_NODE,
103
103
  markupIndex: null,
104
- textContent: null,
104
+ content: null,
105
105
  fromIndex: fromIndex,
106
106
  toIndex: null
107
107
  });
108
108
  }
109
109
 
110
+ /**
111
+ * Enqueues setting the markup of a node.
112
+ *
113
+ * @param {string} parentID ID of the parent component.
114
+ * @param {string} markup Markup that renders into an element.
115
+ * @private
116
+ */
117
+ function enqueueSetMarkup(parentID, markup) {
118
+ // NOTE: Null values reduce hidden classes.
119
+ updateQueue.push({
120
+ parentID: parentID,
121
+ parentNode: null,
122
+ type: ReactMultiChildUpdateTypes.SET_MARKUP,
123
+ markupIndex: null,
124
+ content: markup,
125
+ fromIndex: null,
126
+ toIndex: null
127
+ });
128
+ }
129
+
110
130
  /**
111
131
  * Enqueues setting the text content.
112
132
  *
@@ -121,7 +141,7 @@ function enqueueTextContent(parentID, textContent) {
121
141
  parentNode: null,
122
142
  type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
123
143
  markupIndex: null,
124
- textContent: textContent,
144
+ content: textContent,
125
145
  fromIndex: null,
126
146
  toIndex: null
127
147
  });
@@ -209,7 +229,7 @@ var ReactMultiChild = {
209
229
  // TODO: The setTextContent operation should be enough
210
230
  for (var name in prevChildren) {
211
231
  if (prevChildren.hasOwnProperty(name)) {
212
- this._unmountChildByName(prevChildren[name], name);
232
+ this._unmountChild(prevChildren[name]);
213
233
  }
214
234
  }
215
235
  // Set new text content.
@@ -227,18 +247,50 @@ var ReactMultiChild = {
227
247
  }
228
248
  },
229
249
 
250
+ /**
251
+ * Replaces any rendered children with a markup string.
252
+ *
253
+ * @param {string} nextMarkup String of markup.
254
+ * @internal
255
+ */
256
+ updateMarkup: function (nextMarkup) {
257
+ updateDepth++;
258
+ var errorThrown = true;
259
+ try {
260
+ var prevChildren = this._renderedChildren;
261
+ // Remove any rendered children.
262
+ ReactChildReconciler.unmountChildren(prevChildren);
263
+ for (var name in prevChildren) {
264
+ if (prevChildren.hasOwnProperty(name)) {
265
+ this._unmountChildByName(prevChildren[name], name);
266
+ }
267
+ }
268
+ this.setMarkup(nextMarkup);
269
+ errorThrown = false;
270
+ } finally {
271
+ updateDepth--;
272
+ if (!updateDepth) {
273
+ if (errorThrown) {
274
+ clearQueue();
275
+ } else {
276
+ processQueue();
277
+ }
278
+ }
279
+ }
280
+ },
281
+
230
282
  /**
231
283
  * Updates the rendered children with new children.
232
284
  *
233
- * @param {?object} nextNestedChildren Nested child maps.
285
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
234
286
  * @param {ReactReconcileTransaction} transaction
235
287
  * @internal
236
288
  */
237
- updateChildren: function (nextNestedChildren, transaction, context) {
289
+ updateChildren: function (nextNestedChildrenElements, transaction, context) {
238
290
  updateDepth++;
239
291
  var errorThrown = true;
240
292
  try {
241
- this._updateChildren(nextNestedChildren, transaction, context);
293
+ this._updateChildren(nextNestedChildrenElements, transaction, context);
242
294
  errorThrown = false;
243
295
  } finally {
244
296
  updateDepth--;
@@ -256,14 +308,14 @@ var ReactMultiChild = {
256
308
  * Improve performance by isolating this hot code path from the try/catch
257
309
  * block in `updateChildren`.
258
310
  *
259
- * @param {?object} nextNestedChildren Nested child maps.
311
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
260
312
  * @param {ReactReconcileTransaction} transaction
261
313
  * @final
262
314
  * @protected
263
315
  */
264
- _updateChildren: function (nextNestedChildren, transaction, context) {
316
+ _updateChildren: function (nextNestedChildrenElements, transaction, context) {
265
317
  var prevChildren = this._renderedChildren;
266
- var nextChildren = ReactChildReconciler.updateChildren(prevChildren, nextNestedChildren, transaction, context);
318
+ var nextChildren = ReactChildReconciler.updateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
267
319
  this._renderedChildren = nextChildren;
268
320
  if (!nextChildren && !prevChildren) {
269
321
  return;
@@ -287,7 +339,7 @@ var ReactMultiChild = {
287
339
  if (prevChild) {
288
340
  // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
289
341
  lastIndex = Math.max(prevChild._mountIndex, lastIndex);
290
- this._unmountChildByName(prevChild, name);
342
+ this._unmountChild(prevChild);
291
343
  }
292
344
  // The child must be instantiated before it's mounted.
293
345
  this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
@@ -297,7 +349,7 @@ var ReactMultiChild = {
297
349
  // Remove children that are no longer present.
298
350
  for (name in prevChildren) {
299
351
  if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
300
- this._unmountChildByName(prevChildren[name], name);
352
+ this._unmountChild(prevChildren[name]);
301
353
  }
302
354
  }
303
355
  },
@@ -339,7 +391,7 @@ var ReactMultiChild = {
339
391
  * @protected
340
392
  */
341
393
  createChild: function (child, mountImage) {
342
- enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
394
+ enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
343
395
  },
344
396
 
345
397
  /**
@@ -362,6 +414,16 @@ var ReactMultiChild = {
362
414
  enqueueTextContent(this._rootNodeID, textContent);
363
415
  },
364
416
 
417
+ /**
418
+ * Sets this markup string.
419
+ *
420
+ * @param {string} markup Markup to set.
421
+ * @protected
422
+ */
423
+ setMarkup: function (markup) {
424
+ enqueueSetMarkup(this._rootNodeID, markup);
425
+ },
426
+
365
427
  /**
366
428
  * Mounts a child with the supplied name.
367
429
  *
@@ -382,15 +444,14 @@ var ReactMultiChild = {
382
444
  },
383
445
 
384
446
  /**
385
- * Unmounts a rendered child by name.
447
+ * Unmounts a rendered child.
386
448
  *
387
449
  * NOTE: This is part of `updateChildren` and is here for readability.
388
450
  *
389
451
  * @param {ReactComponent} child Component to unmount.
390
- * @param {string} name Name of the child in `this._renderedChildren`.
391
452
  * @private
392
453
  */
393
- _unmountChildByName: function (child, name) {
454
+ _unmountChild: function (child) {
394
455
  this.removeChild(child);
395
456
  child._mountIndex = null;
396
457
  }