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
@@ -0,0 +1,18 @@
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 ReactDOMComponentFlags
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactDOMComponentFlags = {
15
+ hasCachedChildNodes: 1 << 0
16
+ };
17
+
18
+ module.exports = ReactDOMComponentFlags;
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Copyright 2013-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 ReactDOMComponentTree
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var DOMProperty = require('./DOMProperty');
15
+ var ReactDOMComponentFlags = require('./ReactDOMComponentFlags');
16
+
17
+ var invariant = require('fbjs/lib/invariant');
18
+
19
+ var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
20
+ var Flags = ReactDOMComponentFlags;
21
+
22
+ var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
23
+
24
+ /**
25
+ * Drill down (through composites and empty components) until we get a native or
26
+ * native text component.
27
+ *
28
+ * This is pretty polymorphic but unavoidable with the current structure we have
29
+ * for `_renderedChildren`.
30
+ */
31
+ function getRenderedNativeOrTextFromComponent(component) {
32
+ var rendered;
33
+ while (rendered = component._renderedComponent) {
34
+ component = rendered;
35
+ }
36
+ return component;
37
+ }
38
+
39
+ /**
40
+ * Populate `_nativeNode` on the rendered native/text component with the given
41
+ * DOM node. The passed `inst` can be a composite.
42
+ */
43
+ function precacheNode(inst, node) {
44
+ var nativeInst = getRenderedNativeOrTextFromComponent(inst);
45
+ nativeInst._nativeNode = node;
46
+ node[internalInstanceKey] = nativeInst;
47
+ }
48
+
49
+ function uncacheNode(inst) {
50
+ var node = inst._nativeNode;
51
+ if (node) {
52
+ delete node[internalInstanceKey];
53
+ inst._nativeNode = null;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Populate `_nativeNode` on each child of `inst`, assuming that the children
59
+ * match up with the DOM (element) children of `node`.
60
+ *
61
+ * We cache entire levels at once to avoid an n^2 problem where we access the
62
+ * children of a node sequentially and have to walk from the start to our target
63
+ * node every time.
64
+ *
65
+ * Since we update `_renderedChildren` and the actual DOM at (slightly)
66
+ * different times, we could race here and see a newer `_renderedChildren` than
67
+ * the DOM nodes we see. To avoid this, ReactMultiChild calls
68
+ * `prepareToManageChildren` before we change `_renderedChildren`, at which
69
+ * time the container's child nodes are always cached (until it unmounts).
70
+ */
71
+ function precacheChildNodes(inst, node) {
72
+ if (inst._flags & Flags.hasCachedChildNodes) {
73
+ return;
74
+ }
75
+ var children = inst._renderedChildren;
76
+ var childNode = node.firstChild;
77
+ outer: for (var name in children) {
78
+ if (!children.hasOwnProperty(name)) {
79
+ continue;
80
+ }
81
+ var childInst = children[name];
82
+ var childID = getRenderedNativeOrTextFromComponent(childInst)._domID;
83
+ if (childID == null) {
84
+ // We're currently unmounting this child in ReactMultiChild; skip it.
85
+ continue;
86
+ }
87
+ // We assume the child nodes are in the same order as the child instances.
88
+ for (; childNode !== null; childNode = childNode.nextSibling) {
89
+ if (childNode.nodeType === 1 && childNode.getAttribute(ATTR_NAME) === String(childID) || childNode.nodeType === 8 && childNode.nodeValue === ' react-text: ' + childID + ' ' || childNode.nodeType === 8 && childNode.nodeValue === ' react-empty: ' + childID + ' ') {
90
+ precacheNode(childInst, childNode);
91
+ continue outer;
92
+ }
93
+ }
94
+ // We reached the end of the DOM children without finding an ID match.
95
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : invariant(false) : void 0;
96
+ }
97
+ inst._flags |= Flags.hasCachedChildNodes;
98
+ }
99
+
100
+ /**
101
+ * Given a DOM node, return the closest ReactDOMComponent or
102
+ * ReactDOMTextComponent instance ancestor.
103
+ */
104
+ function getClosestInstanceFromNode(node) {
105
+ if (node[internalInstanceKey]) {
106
+ return node[internalInstanceKey];
107
+ }
108
+
109
+ // Walk up the tree until we find an ancestor whose instance we have cached.
110
+ var parents = [];
111
+ while (!node[internalInstanceKey]) {
112
+ parents.push(node);
113
+ if (node.parentNode) {
114
+ node = node.parentNode;
115
+ } else {
116
+ // Top of the tree. This node must not be part of a React tree (or is
117
+ // unmounted, potentially).
118
+ return null;
119
+ }
120
+ }
121
+
122
+ var closest;
123
+ var inst;
124
+ for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
125
+ closest = inst;
126
+ if (parents.length) {
127
+ precacheChildNodes(inst, node);
128
+ }
129
+ }
130
+
131
+ return closest;
132
+ }
133
+
134
+ /**
135
+ * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
136
+ * instance, or null if the node was not rendered by this React.
137
+ */
138
+ function getInstanceFromNode(node) {
139
+ var inst = getClosestInstanceFromNode(node);
140
+ if (inst != null && inst._nativeNode === node) {
141
+ return inst;
142
+ } else {
143
+ return null;
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
149
+ * DOM node.
150
+ */
151
+ function getNodeFromInstance(inst) {
152
+ // Without this first invariant, passing a non-DOM-component triggers the next
153
+ // invariant for a missing parent, which is super confusing.
154
+ !(inst._nativeNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
155
+
156
+ if (inst._nativeNode) {
157
+ return inst._nativeNode;
158
+ }
159
+
160
+ // Walk up the tree until we find an ancestor whose DOM node we have cached.
161
+ var parents = [];
162
+ while (!inst._nativeNode) {
163
+ parents.push(inst);
164
+ !inst._nativeParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : invariant(false) : void 0;
165
+ inst = inst._nativeParent;
166
+ }
167
+
168
+ // Now parents contains each ancestor that does *not* have a cached native
169
+ // node, and `inst` is the deepest ancestor that does.
170
+ for (; parents.length; inst = parents.pop()) {
171
+ precacheChildNodes(inst, inst._nativeNode);
172
+ }
173
+
174
+ return inst._nativeNode;
175
+ }
176
+
177
+ var ReactDOMComponentTree = {
178
+ getClosestInstanceFromNode: getClosestInstanceFromNode,
179
+ getInstanceFromNode: getInstanceFromNode,
180
+ getNodeFromInstance: getNodeFromInstance,
181
+ precacheChildNodes: precacheChildNodes,
182
+ precacheNode: precacheNode,
183
+ uncacheNode: uncacheNode
184
+ };
185
+
186
+ module.exports = ReactDOMComponentTree;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright 2013-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 ReactDOMContainerInfo
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var validateDOMNesting = require('./validateDOMNesting');
15
+
16
+ var DOC_NODE_TYPE = 9;
17
+
18
+ function ReactDOMContainerInfo(topLevelWrapper, node) {
19
+ var info = {
20
+ _topLevelWrapper: topLevelWrapper,
21
+ _idCounter: 1,
22
+ _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
23
+ _tag: node ? node.nodeName.toLowerCase() : null,
24
+ _namespaceURI: node ? node.namespaceURI : null
25
+ };
26
+ if (process.env.NODE_ENV !== 'production') {
27
+ info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
28
+ }
29
+ return info;
30
+ }
31
+
32
+ module.exports = ReactDOMContainerInfo;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright 2013-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 ReactDOMDebugTool
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactDOMUnknownPropertyDevtool = require('./ReactDOMUnknownPropertyDevtool');
15
+
16
+ var warning = require('fbjs/lib/warning');
17
+
18
+ var eventHandlers = [];
19
+ var handlerDoesThrowForEvent = {};
20
+
21
+ function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
22
+ if (process.env.NODE_ENV !== 'production') {
23
+ eventHandlers.forEach(function (handler) {
24
+ try {
25
+ if (handler[handlerFunctionName]) {
26
+ handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
27
+ }
28
+ } catch (e) {
29
+ process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) : void 0;
30
+ handlerDoesThrowForEvent[handlerFunctionName] = true;
31
+ }
32
+ });
33
+ }
34
+ }
35
+
36
+ var ReactDOMDebugTool = {
37
+ addDevtool: function (devtool) {
38
+ eventHandlers.push(devtool);
39
+ },
40
+ removeDevtool: function (devtool) {
41
+ for (var i = 0; i < eventHandlers.length; i++) {
42
+ if (eventHandlers[i] === devtool) {
43
+ eventHandlers.splice(i, 1);
44
+ i--;
45
+ }
46
+ }
47
+ },
48
+ onCreateMarkupForProperty: function (name, value) {
49
+ emitEvent('onCreateMarkupForProperty', name, value);
50
+ },
51
+ onSetValueForProperty: function (node, name, value) {
52
+ emitEvent('onSetValueForProperty', node, name, value);
53
+ },
54
+ onDeleteValueForProperty: function (node, name) {
55
+ emitEvent('onDeleteValueForProperty', node, name);
56
+ }
57
+ };
58
+
59
+ ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
60
+
61
+ module.exports = ReactDOMDebugTool;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Copyright 2014-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 ReactDOMEmptyComponent
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var _assign = require('object-assign');
15
+
16
+ var DOMLazyTree = require('./DOMLazyTree');
17
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
18
+
19
+ var ReactDOMEmptyComponent = function (instantiate) {
20
+ // ReactCompositeComponent uses this:
21
+ this._currentElement = null;
22
+ // ReactDOMComponentTree uses these:
23
+ this._nativeNode = null;
24
+ this._nativeParent = null;
25
+ this._nativeContainerInfo = null;
26
+ this._domID = null;
27
+ };
28
+ _assign(ReactDOMEmptyComponent.prototype, {
29
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
30
+ var domID = nativeContainerInfo._idCounter++;
31
+ this._domID = domID;
32
+ this._nativeParent = nativeParent;
33
+ this._nativeContainerInfo = nativeContainerInfo;
34
+
35
+ var nodeValue = ' react-empty: ' + this._domID + ' ';
36
+ if (transaction.useCreateElement) {
37
+ var ownerDocument = nativeContainerInfo._ownerDocument;
38
+ var node = ownerDocument.createComment(nodeValue);
39
+ ReactDOMComponentTree.precacheNode(this, node);
40
+ return DOMLazyTree(node);
41
+ } else {
42
+ if (transaction.renderToStaticMarkup) {
43
+ // Normally we'd insert a comment node, but since this is a situation
44
+ // where React won't take over (static pages), we can simply return
45
+ // nothing.
46
+ return '';
47
+ }
48
+ return '<!--' + nodeValue + '-->';
49
+ }
50
+ },
51
+ receiveComponent: function () {},
52
+ getNativeNode: function () {
53
+ return ReactDOMComponentTree.getNodeFromInstance(this);
54
+ },
55
+ unmountComponent: function () {
56
+ ReactDOMComponentTree.uncacheNode(this);
57
+ }
58
+ });
59
+
60
+ module.exports = ReactDOMEmptyComponent;
@@ -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 ReactDOMFactories
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
@@ -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
@@ -12,7 +12,7 @@
12
12
  'use strict';
13
13
 
14
14
  var ReactDOMFeatureFlags = {
15
- useCreateElement: false
15
+ useCreateElement: true
16
16
  };
17
17
 
18
18
  module.exports = ReactDOMFeatureFlags;
@@ -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,87 +7,32 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactDOMIDOperations
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
14
  var DOMChildrenOperations = require('./DOMChildrenOperations');
16
- var DOMPropertyOperations = require('./DOMPropertyOperations');
17
- var ReactMount = require('./ReactMount');
15
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
18
16
  var ReactPerf = require('./ReactPerf');
19
17
 
20
- var invariant = require('fbjs/lib/invariant');
21
-
22
- /**
23
- * Errors for properties that should not be updated with `updatePropertyByID()`.
24
- *
25
- * @type {object}
26
- * @private
27
- */
28
- var INVALID_PROPERTY_ERRORS = {
29
- dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
30
- style: '`style` must be set using `updateStylesByID()`.'
31
- };
32
-
33
18
  /**
34
19
  * Operations used to process updates to DOM nodes.
35
20
  */
36
21
  var ReactDOMIDOperations = {
37
22
 
38
- /**
39
- * Updates a DOM node with new property values. This should only be used to
40
- * update DOM properties in `DOMProperty`.
41
- *
42
- * @param {string} id ID of the node to update.
43
- * @param {string} name A valid property name, see `DOMProperty`.
44
- * @param {*} value New value of the property.
45
- * @internal
46
- */
47
- updatePropertyByID: function (id, name, value) {
48
- var node = ReactMount.getNode(id);
49
- !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
50
-
51
- // If we're updating to null or undefined, we should remove the property
52
- // from the DOM node instead of inadvertantly setting to a string. This
53
- // brings us in line with the same behavior we have on initial render.
54
- if (value != null) {
55
- DOMPropertyOperations.setValueForProperty(node, name, value);
56
- } else {
57
- DOMPropertyOperations.deleteValueForProperty(node, name);
58
- }
59
- },
60
-
61
- /**
62
- * Replaces a DOM node that exists in the document with markup.
63
- *
64
- * @param {string} id ID of child to be replaced.
65
- * @param {string} markup Dangerous markup to inject in place of child.
66
- * @internal
67
- * @see {Danger.dangerouslyReplaceNodeWithMarkup}
68
- */
69
- dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
70
- var node = ReactMount.getNode(id);
71
- DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
72
- },
73
-
74
23
  /**
75
24
  * Updates a component's children by processing a series of updates.
76
25
  *
77
26
  * @param {array<object>} updates List of update configurations.
78
- * @param {array<string>} markup List of markup strings.
79
27
  * @internal
80
28
  */
81
- dangerouslyProcessChildrenUpdates: function (updates, markup) {
82
- for (var i = 0; i < updates.length; i++) {
83
- updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
84
- }
85
- DOMChildrenOperations.processUpdates(updates, markup);
29
+ dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
30
+ var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
31
+ DOMChildrenOperations.processUpdates(node, updates);
86
32
  }
87
33
  };
88
34
 
89
35
  ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
90
- dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
91
36
  dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
92
37
  });
93
38