react 0.14.10 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/LICENSE +1 -1
  2. package/dist/react-with-addons.js +4900 -4627
  3. package/dist/react-with-addons.min.js +7 -7
  4. package/dist/react.js +4556 -4059
  5. package/dist/react.min.js +7 -7
  6. package/lib/AutoFocusUtils.js +3 -15
  7. package/lib/BeforeInputEventPlugin.js +8 -25
  8. package/lib/CSSProperty.js +10 -1
  9. package/lib/CSSPropertyOperations.js +49 -19
  10. package/lib/CallbackQueue.js +16 -4
  11. package/lib/ChangeEventPlugin.js +58 -54
  12. package/lib/DOMChildrenOperations.js +91 -61
  13. package/lib/DOMLazyTree.js +105 -0
  14. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  15. package/lib/DOMProperty.js +18 -39
  16. package/lib/DOMPropertyOperations.js +42 -53
  17. package/lib/Danger.js +13 -14
  18. package/lib/DefaultEventPluginOrder.js +1 -1
  19. package/lib/EnterLeaveEventPlugin.js +24 -43
  20. package/lib/EventConstants.js +6 -1
  21. package/lib/EventPluginHub.js +22 -66
  22. package/lib/EventPluginRegistry.js +30 -9
  23. package/lib/EventPluginUtils.js +61 -36
  24. package/lib/EventPropagators.js +19 -17
  25. package/lib/FallbackCompositionState.js +4 -4
  26. package/lib/HTMLDOMPropertyConfig.js +131 -152
  27. package/lib/LinkedStateMixin.js +1 -2
  28. package/lib/LinkedValueUtils.js +6 -7
  29. package/lib/MetaMatchers.js +2 -2
  30. package/lib/OrderedMap.js +17 -16
  31. package/lib/PooledClass.js +2 -2
  32. package/lib/React.js +50 -20
  33. package/lib/ReactBrowserEventEmitter.js +19 -26
  34. package/lib/ReactCSSTransitionGroup.js +4 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  36. package/lib/ReactChildReconciler.js +15 -13
  37. package/lib/ReactChildren.js +5 -4
  38. package/lib/ReactClass.js +44 -92
  39. package/lib/ReactComponent.js +9 -10
  40. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  41. package/lib/ReactComponentEnvironment.js +4 -4
  42. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  43. package/lib/ReactCompositeComponent.js +166 -74
  44. package/lib/ReactCurrentOwner.js +2 -1
  45. package/lib/ReactDOM.js +27 -15
  46. package/lib/ReactDOMButton.js +2 -2
  47. package/lib/ReactDOMComponent.js +186 -250
  48. package/lib/ReactDOMComponentFlags.js +18 -0
  49. package/lib/ReactDOMComponentTree.js +186 -0
  50. package/lib/ReactDOMContainerInfo.js +32 -0
  51. package/lib/ReactDOMDebugTool.js +61 -0
  52. package/lib/ReactDOMEmptyComponent.js +60 -0
  53. package/lib/ReactDOMFactories.js +1 -2
  54. package/lib/ReactDOMFeatureFlags.js +2 -2
  55. package/lib/ReactDOMIDOperations.js +5 -60
  56. package/lib/ReactDOMInput.js +73 -23
  57. package/lib/ReactDOMInstrumentation.js +16 -0
  58. package/lib/ReactDOMOption.js +14 -12
  59. package/lib/ReactDOMSelect.js +43 -19
  60. package/lib/ReactDOMSelection.js +4 -4
  61. package/lib/ReactDOMServer.js +1 -1
  62. package/lib/ReactDOMTextComponent.js +87 -45
  63. package/lib/ReactDOMTextarea.js +39 -11
  64. package/lib/ReactDOMTreeTraversal.js +134 -0
  65. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  66. package/lib/ReactDebugInstanceMap.js +102 -0
  67. package/lib/ReactDebugTool.js +72 -0
  68. package/lib/ReactDefaultBatchingStrategy.js +4 -3
  69. package/lib/ReactDefaultInjection.js +11 -15
  70. package/lib/ReactDefaultPerf.js +105 -26
  71. package/lib/ReactDefaultPerfAnalysis.js +23 -15
  72. package/lib/ReactElement.js +63 -23
  73. package/lib/ReactElementValidator.js +9 -9
  74. package/lib/ReactEmptyComponent.js +8 -33
  75. package/lib/ReactErrorUtils.js +1 -2
  76. package/lib/ReactEventEmitterMixin.js +3 -8
  77. package/lib/ReactEventListener.js +23 -77
  78. package/lib/ReactFeatureFlags.js +21 -0
  79. package/lib/ReactFragment.js +6 -6
  80. package/lib/ReactInjection.js +3 -3
  81. package/lib/ReactInputSelection.js +4 -4
  82. package/lib/ReactInstanceHandles.js +10 -12
  83. package/lib/ReactInstanceMap.js +2 -1
  84. package/lib/ReactInstrumentation.js +16 -0
  85. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  86. package/lib/ReactLink.js +2 -3
  87. package/lib/ReactMarkupChecksum.js +8 -3
  88. package/lib/ReactMount.js +88 -460
  89. package/lib/ReactMultiChild.js +106 -200
  90. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  91. package/lib/ReactNativeComponent.js +6 -5
  92. package/lib/ReactNodeTypes.js +37 -0
  93. package/lib/ReactNoopUpdateQueue.js +2 -25
  94. package/lib/ReactOwner.js +7 -6
  95. package/lib/ReactPerf.js +2 -2
  96. package/lib/ReactPropTransferer.js +5 -4
  97. package/lib/ReactPropTypeLocationNames.js +1 -1
  98. package/lib/ReactPropTypeLocations.js +1 -1
  99. package/lib/ReactPropTypes.js +31 -7
  100. package/lib/ReactReconcileTransaction.js +20 -9
  101. package/lib/ReactReconciler.js +29 -6
  102. package/lib/ReactRef.js +1 -1
  103. package/lib/ReactServerBatchingStrategy.js +1 -2
  104. package/lib/ReactServerRendering.js +17 -35
  105. package/lib/ReactServerRenderingTransaction.js +11 -29
  106. package/lib/ReactSimpleEmptyComponent.js +36 -0
  107. package/lib/ReactStateSetters.js +1 -1
  108. package/lib/ReactTestUtils.js +47 -28
  109. package/lib/ReactTransitionChildMapping.js +1 -2
  110. package/lib/ReactTransitionEvents.js +8 -44
  111. package/lib/ReactTransitionGroup.js +4 -3
  112. package/lib/ReactUMDEntry.js +26 -0
  113. package/lib/ReactUpdateQueue.js +24 -66
  114. package/lib/ReactUpdates.js +29 -11
  115. package/lib/ReactVersion.js +2 -2
  116. package/lib/ReactWithAddons.js +1 -21
  117. package/lib/ReactWithAddonsUMDEntry.js +26 -0
  118. package/lib/ResponderEventPlugin.js +54 -66
  119. package/lib/ResponderSyntheticEvent.js +2 -3
  120. package/lib/ResponderTouchHistoryStore.js +5 -5
  121. package/lib/SVGDOMPropertyConfig.js +267 -94
  122. package/lib/SelectEventPlugin.js +13 -18
  123. package/lib/SimpleEventPlugin.js +57 -17
  124. package/lib/SyntheticAnimationEvent.js +39 -0
  125. package/lib/SyntheticClipboardEvent.js +2 -3
  126. package/lib/SyntheticCompositionEvent.js +2 -3
  127. package/lib/SyntheticDragEvent.js +2 -3
  128. package/lib/SyntheticEvent.js +102 -21
  129. package/lib/SyntheticFocusEvent.js +2 -3
  130. package/lib/SyntheticInputEvent.js +2 -3
  131. package/lib/SyntheticKeyboardEvent.js +2 -3
  132. package/lib/SyntheticMouseEvent.js +2 -3
  133. package/lib/SyntheticTouchEvent.js +2 -3
  134. package/lib/SyntheticTransitionEvent.js +39 -0
  135. package/lib/SyntheticUIEvent.js +2 -3
  136. package/lib/SyntheticWheelEvent.js +2 -3
  137. package/lib/TapEventPlugin.js +3 -12
  138. package/lib/Transaction.js +3 -3
  139. package/lib/ViewportMetrics.js +1 -1
  140. package/lib/accumulate.js +2 -2
  141. package/lib/accumulateInto.js +2 -2
  142. package/lib/adler32.js +3 -2
  143. package/lib/canDefineProperty.js +1 -1
  144. package/lib/createHierarchyRenderer.js +1 -1
  145. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  146. package/lib/dangerousStyleValue.js +25 -3
  147. package/lib/deprecated.js +7 -4
  148. package/lib/escapeTextContentForBrowser.js +1 -1
  149. package/lib/findDOMNode.js +15 -8
  150. package/lib/flattenChildren.js +2 -2
  151. package/lib/forEachAccumulated.js +2 -1
  152. package/lib/getEventCharCode.js +2 -2
  153. package/lib/getEventKey.js +1 -2
  154. package/lib/getEventModifierState.js +1 -2
  155. package/lib/getEventTarget.js +8 -2
  156. package/lib/getIteratorFn.js +2 -2
  157. package/lib/getNativeComponentFromComposite.js +30 -0
  158. package/lib/getNodeForCharacterOffset.js +2 -1
  159. package/lib/getTestDocument.js +1 -1
  160. package/lib/getTextContentAccessor.js +1 -1
  161. package/lib/getVendorPrefixedEventName.js +101 -0
  162. package/lib/instantiateReactComponent.js +12 -13
  163. package/lib/isEventSupported.js +2 -2
  164. package/lib/isTextInputElement.js +2 -1
  165. package/lib/onlyChild.js +2 -2
  166. package/lib/quoteAttributeValueForBrowser.js +1 -1
  167. package/lib/reactComponentExpect.js +5 -4
  168. package/lib/renderSubtreeIntoContainer.js +1 -1
  169. package/lib/setInnerHTML.js +6 -14
  170. package/lib/setTextContent.js +1 -1
  171. package/lib/shallowCompare.js +1 -1
  172. package/lib/shouldUpdateReactComponent.js +2 -3
  173. package/lib/sliceChildren.js +1 -1
  174. package/lib/traverseAllChildren.js +8 -8
  175. package/lib/update.js +16 -15
  176. package/lib/validateDOMNesting.js +18 -13
  177. package/package.json +23 -32
  178. package/addons.js +0 -13
  179. package/cjs/react-jsx-dev-runtime.development.js +0 -861
  180. package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  181. package/cjs/react-jsx-runtime.development.js +0 -883
  182. package/cjs/react-jsx-runtime.production.min.js +0 -10
  183. package/jsx-dev-runtime.js +0 -7
  184. package/jsx-runtime.js +0 -7
  185. package/lib/Object.assign.js +0 -47
  186. package/lib/React.native.js +0 -5
  187. package/lib/ReactBrowserComponentMixin.js +0 -36
  188. package/lib/ReactEmptyComponentRegistry.js +0 -48
  189. package/lib/ReactIsomorphic.js +0 -74
  190. package/lib/ReactRootIndex.js +0 -29
  191. package/lib/ServerReactRootIndex.js +0 -29
  192. package/lib/cloneWithProps.js +0 -54
  193. package/lib/webcomponents.js +0 -6379
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,18 +7,27 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule DOMChildrenOperations
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
14
+ var DOMLazyTree = require('./DOMLazyTree');
15
15
  var Danger = require('./Danger');
16
16
  var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
17
17
  var ReactPerf = require('./ReactPerf');
18
18
 
19
+ var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');
19
20
  var setInnerHTML = require('./setInnerHTML');
20
21
  var setTextContent = require('./setTextContent');
21
- var invariant = require('fbjs/lib/invariant');
22
+
23
+ function getNodeAfter(parentNode, node) {
24
+ // Special case for text components, which return [open, close] comments
25
+ // from getNativeNode.
26
+ if (Array.isArray(node)) {
27
+ node = node[1];
28
+ }
29
+ return node ? node.nextSibling : parentNode.firstChild;
30
+ }
22
31
 
23
32
  /**
24
33
  * Inserts `childNode` as a child of `parentNode` at the `index`.
@@ -28,17 +37,78 @@ var invariant = require('fbjs/lib/invariant');
28
37
  * @param {number} index Index at which to insert the child.
29
38
  * @internal
30
39
  */
31
- function insertChildAt(parentNode, childNode, index) {
32
- // By exploiting arrays returning `undefined` for an undefined index, we can
33
- // rely exclusively on `insertBefore(node, null)` instead of also using
34
- // `appendChild(node)`. However, using `undefined` is not allowed by all
35
- // browsers so we must replace it with `null`.
40
+ var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
41
+ // We rely exclusively on `insertBefore(node, null)` instead of also using
42
+ // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
43
+ // we are careful to use `null`.)
44
+ parentNode.insertBefore(childNode, referenceNode);
45
+ });
36
46
 
37
- // fix render order error in safari
38
- // IE8 will throw error when index out of list size.
39
- var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
47
+ function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
48
+ DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
49
+ }
40
50
 
41
- parentNode.insertBefore(childNode, beforeChild);
51
+ function moveChild(parentNode, childNode, referenceNode) {
52
+ if (Array.isArray(childNode)) {
53
+ moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
54
+ } else {
55
+ insertChildAt(parentNode, childNode, referenceNode);
56
+ }
57
+ }
58
+
59
+ function removeChild(parentNode, childNode) {
60
+ if (Array.isArray(childNode)) {
61
+ var closingComment = childNode[1];
62
+ childNode = childNode[0];
63
+ removeDelimitedText(parentNode, childNode, closingComment);
64
+ parentNode.removeChild(closingComment);
65
+ }
66
+ parentNode.removeChild(childNode);
67
+ }
68
+
69
+ function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
70
+ var node = openingComment;
71
+ while (true) {
72
+ var nextNode = node.nextSibling;
73
+ insertChildAt(parentNode, node, referenceNode);
74
+ if (node === closingComment) {
75
+ break;
76
+ }
77
+ node = nextNode;
78
+ }
79
+ }
80
+
81
+ function removeDelimitedText(parentNode, startNode, closingComment) {
82
+ while (true) {
83
+ var node = startNode.nextSibling;
84
+ if (node === closingComment) {
85
+ // The closing comment is removed by ReactMultiChild.
86
+ break;
87
+ } else {
88
+ parentNode.removeChild(node);
89
+ }
90
+ }
91
+ }
92
+
93
+ function replaceDelimitedText(openingComment, closingComment, stringText) {
94
+ var parentNode = openingComment.parentNode;
95
+ var nodeAfterComment = openingComment.nextSibling;
96
+ if (nodeAfterComment === closingComment) {
97
+ // There are no text nodes between the opening and closing comments; insert
98
+ // a new one if stringText isn't empty.
99
+ if (stringText) {
100
+ insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
101
+ }
102
+ } else {
103
+ if (stringText) {
104
+ // Set the text content of the first node after the opening comment, and
105
+ // remove all following nodes up until the closing comment.
106
+ setTextContent(nodeAfterComment, stringText);
107
+ removeDelimitedText(parentNode, nodeAfterComment, closingComment);
108
+ } else {
109
+ removeDelimitedText(parentNode, openingComment, closingComment);
110
+ }
111
+ }
42
112
  }
43
113
 
44
114
  /**
@@ -48,73 +118,33 @@ var DOMChildrenOperations = {
48
118
 
49
119
  dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
50
120
 
51
- updateTextContent: setTextContent,
121
+ replaceDelimitedText: replaceDelimitedText,
52
122
 
53
123
  /**
54
124
  * Updates a component's children by processing a series of updates. The
55
125
  * update configurations are each expected to have a `parentNode` property.
56
126
  *
57
127
  * @param {array<object>} updates List of update configurations.
58
- * @param {array<string>} markupList List of markup strings.
59
128
  * @internal
60
129
  */
61
- processUpdates: function (updates, markupList) {
62
- var update;
63
- // Mapping from parent IDs to initial child orderings.
64
- var initialChildren = null;
65
- // List of children that will be moved or removed.
66
- var updatedChildren = null;
67
-
68
- for (var i = 0; i < updates.length; i++) {
69
- update = updates[i];
70
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
71
- var updatedIndex = update.fromIndex;
72
- var updatedChild = update.parentNode.childNodes[updatedIndex];
73
- var parentID = update.parentID;
74
-
75
- !updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of 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`.', updatedIndex, parentID) : invariant(false) : undefined;
76
-
77
- initialChildren = initialChildren || {};
78
- initialChildren[parentID] = initialChildren[parentID] || [];
79
- initialChildren[parentID][updatedIndex] = updatedChild;
80
-
81
- updatedChildren = updatedChildren || [];
82
- updatedChildren.push(updatedChild);
83
- }
84
- }
85
-
86
- var renderedMarkup;
87
- // markupList is either a list of markup or just a list of elements
88
- if (markupList.length && typeof markupList[0] === 'string') {
89
- renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
90
- } else {
91
- renderedMarkup = markupList;
92
- }
93
-
94
- // Remove updated children first so that `toIndex` is consistent.
95
- if (updatedChildren) {
96
- for (var j = 0; j < updatedChildren.length; j++) {
97
- updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
98
- }
99
- }
100
-
130
+ processUpdates: function (parentNode, updates) {
101
131
  for (var k = 0; k < updates.length; k++) {
102
- update = updates[k];
132
+ var update = updates[k];
103
133
  switch (update.type) {
104
134
  case ReactMultiChildUpdateTypes.INSERT_MARKUP:
105
- insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
135
+ insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
106
136
  break;
107
137
  case ReactMultiChildUpdateTypes.MOVE_EXISTING:
108
- insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
138
+ moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
109
139
  break;
110
140
  case ReactMultiChildUpdateTypes.SET_MARKUP:
111
- setInnerHTML(update.parentNode, update.content);
141
+ setInnerHTML(parentNode, update.content);
112
142
  break;
113
143
  case ReactMultiChildUpdateTypes.TEXT_CONTENT:
114
- setTextContent(update.parentNode, update.content);
144
+ setTextContent(parentNode, update.content);
115
145
  break;
116
146
  case ReactMultiChildUpdateTypes.REMOVE_NODE:
117
- // Already removed by the for-loop above.
147
+ removeChild(parentNode, update.fromNode);
118
148
  break;
119
149
  }
120
150
  }
@@ -123,7 +153,7 @@ var DOMChildrenOperations = {
123
153
  };
124
154
 
125
155
  ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
126
- updateTextContent: 'updateTextContent'
156
+ replaceDelimitedText: 'replaceDelimitedText'
127
157
  });
128
158
 
129
159
  module.exports = DOMChildrenOperations;
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Copyright 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule DOMLazyTree
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');
15
+ var setTextContent = require('./setTextContent');
16
+
17
+ /**
18
+ * In IE (8-11) and Edge, appending nodes with no children is dramatically
19
+ * faster than appending a full subtree, so we essentially queue up the
20
+ * .appendChild calls here and apply them so each node is added to its parent
21
+ * before any children are added.
22
+ *
23
+ * In other browsers, doing so is slower or neutral compared to the other order
24
+ * (in Firefox, twice as slow) so we only do this inversion in IE.
25
+ *
26
+ * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
27
+ */
28
+ var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
29
+
30
+ function insertTreeChildren(tree) {
31
+ if (!enableLazy) {
32
+ return;
33
+ }
34
+ var node = tree.node;
35
+ var children = tree.children;
36
+ if (children.length) {
37
+ for (var i = 0; i < children.length; i++) {
38
+ insertTreeBefore(node, children[i], null);
39
+ }
40
+ } else if (tree.html != null) {
41
+ node.innerHTML = tree.html;
42
+ } else if (tree.text != null) {
43
+ setTextContent(node, tree.text);
44
+ }
45
+ }
46
+
47
+ var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
48
+ // DocumentFragments aren't actually part of the DOM after insertion so
49
+ // appending children won't update the DOM. We need to ensure the fragment
50
+ // is properly populated first, breaking out of our lazy approach for just
51
+ // this level.
52
+ if (tree.node.nodeType === 11) {
53
+ insertTreeChildren(tree);
54
+ parentNode.insertBefore(tree.node, referenceNode);
55
+ } else {
56
+ parentNode.insertBefore(tree.node, referenceNode);
57
+ insertTreeChildren(tree);
58
+ }
59
+ });
60
+
61
+ function replaceChildWithTree(oldNode, newTree) {
62
+ oldNode.parentNode.replaceChild(newTree.node, oldNode);
63
+ insertTreeChildren(newTree);
64
+ }
65
+
66
+ function queueChild(parentTree, childTree) {
67
+ if (enableLazy) {
68
+ parentTree.children.push(childTree);
69
+ } else {
70
+ parentTree.node.appendChild(childTree.node);
71
+ }
72
+ }
73
+
74
+ function queueHTML(tree, html) {
75
+ if (enableLazy) {
76
+ tree.html = html;
77
+ } else {
78
+ tree.node.innerHTML = html;
79
+ }
80
+ }
81
+
82
+ function queueText(tree, text) {
83
+ if (enableLazy) {
84
+ tree.text = text;
85
+ } else {
86
+ setTextContent(tree.node, text);
87
+ }
88
+ }
89
+
90
+ function DOMLazyTree(node) {
91
+ return {
92
+ node: node,
93
+ children: [],
94
+ html: null,
95
+ text: null
96
+ };
97
+ }
98
+
99
+ DOMLazyTree.insertTreeBefore = insertTreeBefore;
100
+ DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
101
+ DOMLazyTree.queueChild = queueChild;
102
+ DOMLazyTree.queueHTML = queueHTML;
103
+ DOMLazyTree.queueText = queueText;
104
+
105
+ module.exports = DOMLazyTree;
@@ -1,23 +1,20 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
- * @providesModule ClientReactRootIndex
10
- * @typechecks
9
+ * @providesModule DOMNamespaces
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
- var nextReactRootIndex = 0;
16
-
17
- var ClientReactRootIndex = {
18
- createReactRootIndex: function () {
19
- return nextReactRootIndex++;
20
- }
14
+ var DOMNamespaces = {
15
+ html: 'http://www.w3.org/1999/xhtml',
16
+ mathml: 'http://www.w3.org/1998/Math/MathML',
17
+ svg: 'http://www.w3.org/2000/svg'
21
18
  };
22
19
 
23
- module.exports = ClientReactRootIndex;
20
+ module.exports = DOMNamespaces;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,7 +7,6 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule DOMProperty
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
@@ -23,13 +22,12 @@ var DOMPropertyInjection = {
23
22
  * Mapping from normalized, camelcased property names to a configuration that
24
23
  * specifies how the associated DOM property should be accessed or rendered.
25
24
  */
26
- MUST_USE_ATTRIBUTE: 0x1,
27
- MUST_USE_PROPERTY: 0x2,
28
- HAS_SIDE_EFFECTS: 0x4,
29
- HAS_BOOLEAN_VALUE: 0x8,
30
- HAS_NUMERIC_VALUE: 0x10,
31
- HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
32
- HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
25
+ MUST_USE_PROPERTY: 0x1,
26
+ HAS_SIDE_EFFECTS: 0x2,
27
+ HAS_BOOLEAN_VALUE: 0x4,
28
+ HAS_NUMERIC_VALUE: 0x8,
29
+ HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
30
+ HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
33
31
 
34
32
  /**
35
33
  * Inject some specialized knowledge about the DOM. This takes a config object
@@ -72,7 +70,7 @@ var DOMPropertyInjection = {
72
70
  }
73
71
 
74
72
  for (var propName in Properties) {
75
- !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
73
+ !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : void 0;
76
74
 
77
75
  var lowerCased = propName.toLowerCase();
78
76
  var propConfig = Properties[propName];
@@ -83,7 +81,6 @@ var DOMPropertyInjection = {
83
81
  propertyName: propName,
84
82
  mutationMethod: null,
85
83
 
86
- mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
87
84
  mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
88
85
  hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
89
86
  hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
@@ -92,9 +89,8 @@ var DOMPropertyInjection = {
92
89
  hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
93
90
  };
94
91
 
95
- !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
96
- !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
97
- !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
92
+ !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : void 0;
93
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : void 0;
98
94
 
99
95
  if (process.env.NODE_ENV !== 'production') {
100
96
  DOMProperty.getPossibleStandardName[lowerCased] = propName;
@@ -124,7 +120,10 @@ var DOMPropertyInjection = {
124
120
  }
125
121
  }
126
122
  };
127
- var defaultValueCache = {};
123
+
124
+ /* eslint-disable max-len */
125
+ var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
126
+ /* eslint-enable max-len */
128
127
 
129
128
  /**
130
129
  * DOMProperty exports lookup objects that can be used like functions:
@@ -142,6 +141,10 @@ var defaultValueCache = {};
142
141
  var DOMProperty = {
143
142
 
144
143
  ID_ATTRIBUTE_NAME: 'data-reactid',
144
+ ROOT_ATTRIBUTE_NAME: 'data-reactroot',
145
+
146
+ ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
147
+ ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\uB7\\u0300-\\u036F\\u203F-\\u2040',
145
148
 
146
149
  /**
147
150
  * Map from property "standard name" to an object with info about how to set
@@ -156,9 +159,6 @@ var DOMProperty = {
156
159
  * mutationMethod:
157
160
  * If non-null, used instead of the property or `setAttribute()` after
158
161
  * initial render.
159
- * mustUseAttribute:
160
- * Whether the property must be accessed and mutated using `*Attribute()`.
161
- * (This includes anything that fails `<propName> in <element>`.)
162
162
  * mustUseProperty:
163
163
  * Whether the property must be accessed and mutated as an object property.
164
164
  * hasSideEffects:
@@ -207,27 +207,6 @@ var DOMProperty = {
207
207
  return false;
208
208
  },
209
209
 
210
- /**
211
- * Returns the default property value for a DOM property (i.e., not an
212
- * attribute). Most default values are '' or false, but not all. Worse yet,
213
- * some (in particular, `type`) vary depending on the type of element.
214
- *
215
- * TODO: Is it better to grab all the possible properties when creating an
216
- * element to avoid having to create the same element twice?
217
- */
218
- getDefaultValueForProperty: function (nodeName, prop) {
219
- var nodeDefaults = defaultValueCache[nodeName];
220
- var testElement;
221
- if (!nodeDefaults) {
222
- defaultValueCache[nodeName] = nodeDefaults = {};
223
- }
224
- if (!(prop in nodeDefaults)) {
225
- testElement = document.createElement(nodeName);
226
- nodeDefaults[prop] = testElement[prop];
227
- }
228
- return nodeDefaults[prop];
229
- },
230
-
231
210
  injection: DOMPropertyInjection
232
211
  };
233
212