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
@@ -17,6 +17,7 @@
17
17
  * The current owner is the component who should own any components that are
18
18
  * currently being constructed.
19
19
  */
20
+
20
21
  var ReactCurrentOwner = {
21
22
 
22
23
  /**
package/lib/ReactDOM.js CHANGED
@@ -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
@@ -13,10 +13,8 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- var ReactCurrentOwner = require('./ReactCurrentOwner');
17
- var ReactDOMTextComponent = require('./ReactDOMTextComponent');
16
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
18
17
  var ReactDefaultInjection = require('./ReactDefaultInjection');
19
- var ReactInstanceHandles = require('./ReactInstanceHandles');
20
18
  var ReactMount = require('./ReactMount');
21
19
  var ReactPerf = require('./ReactPerf');
22
20
  var ReactReconciler = require('./ReactReconciler');
@@ -24,6 +22,7 @@ var ReactUpdates = require('./ReactUpdates');
24
22
  var ReactVersion = require('./ReactVersion');
25
23
 
26
24
  var findDOMNode = require('./findDOMNode');
25
+ var getNativeComponentFromComposite = require('./getNativeComponentFromComposite');
27
26
  var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
28
27
  var warning = require('fbjs/lib/warning');
29
28
 
@@ -47,11 +46,22 @@ var React = {
47
46
  /* eslint-enable camelcase */
48
47
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
49
48
  __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
50
- CurrentOwner: ReactCurrentOwner,
51
- InstanceHandles: ReactInstanceHandles,
49
+ ComponentTree: {
50
+ getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
51
+ getNodeFromInstance: function (inst) {
52
+ // inst is an internal instance (but could be a composite)
53
+ if (inst._renderedComponent) {
54
+ inst = getNativeComponentFromComposite(inst);
55
+ }
56
+ if (inst) {
57
+ return ReactDOMComponentTree.getNodeFromInstance(inst);
58
+ } else {
59
+ return null;
60
+ }
61
+ }
62
+ },
52
63
  Mount: ReactMount,
53
- Reconciler: ReactReconciler,
54
- TextComponent: ReactDOMTextComponent
64
+ Reconciler: ReactReconciler
55
65
  });
56
66
  }
57
67
 
@@ -63,26 +73,28 @@ if (process.env.NODE_ENV !== 'production') {
63
73
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
64
74
  // If we're in Chrome or Firefox, provide a download link if not installed.
65
75
  if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
66
- console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
76
+ // Firefox does not have the issue with devtools loaded over file://
77
+ var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
78
+ console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
67
79
  }
68
80
  }
69
81
 
82
+ var testFunc = function testFn() {};
83
+ process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
84
+
70
85
  // If we're in IE8, check to see if we are in compatibility mode and provide
71
86
  // information on preventing compatibility mode
72
87
  var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
73
88
 
74
- process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
89
+ process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
75
90
 
76
91
  var expectedFeatures = [
77
92
  // shims
78
- Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
79
-
80
- // shams
81
- Object.create, Object.freeze];
93
+ Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim];
82
94
 
83
95
  for (var i = 0; i < expectedFeatures.length; i++) {
84
96
  if (!expectedFeatures[i]) {
85
- console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
97
+ process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
86
98
  break;
87
99
  }
88
100
  }
@@ -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
@@ -30,7 +30,7 @@ var mouseListenerNames = {
30
30
  * when `disabled` is set.
31
31
  */
32
32
  var ReactDOMButton = {
33
- getNativeProps: function (inst, props, context) {
33
+ getNativeProps: function (inst, props) {
34
34
  if (!props.disabled) {
35
35
  return props;
36
36
  }
@@ -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,54 +7,59 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactDOMComponent
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  /* global hasOwnProperty:true */
14
13
 
15
14
  'use strict';
16
15
 
16
+ var _assign = require('object-assign');
17
+
17
18
  var AutoFocusUtils = require('./AutoFocusUtils');
18
19
  var CSSPropertyOperations = require('./CSSPropertyOperations');
20
+ var DOMLazyTree = require('./DOMLazyTree');
21
+ var DOMNamespaces = require('./DOMNamespaces');
19
22
  var DOMProperty = require('./DOMProperty');
20
23
  var DOMPropertyOperations = require('./DOMPropertyOperations');
21
24
  var EventConstants = require('./EventConstants');
25
+ var EventPluginHub = require('./EventPluginHub');
26
+ var EventPluginRegistry = require('./EventPluginRegistry');
22
27
  var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
23
28
  var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
24
29
  var ReactDOMButton = require('./ReactDOMButton');
30
+ var ReactDOMComponentFlags = require('./ReactDOMComponentFlags');
31
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
25
32
  var ReactDOMInput = require('./ReactDOMInput');
26
33
  var ReactDOMOption = require('./ReactDOMOption');
27
34
  var ReactDOMSelect = require('./ReactDOMSelect');
28
35
  var ReactDOMTextarea = require('./ReactDOMTextarea');
29
- var ReactMount = require('./ReactMount');
30
36
  var ReactMultiChild = require('./ReactMultiChild');
31
37
  var ReactPerf = require('./ReactPerf');
32
- var ReactUpdateQueue = require('./ReactUpdateQueue');
33
38
 
34
- var assign = require('./Object.assign');
35
- var canDefineProperty = require('./canDefineProperty');
36
39
  var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
37
40
  var invariant = require('fbjs/lib/invariant');
38
41
  var isEventSupported = require('./isEventSupported');
39
42
  var keyOf = require('fbjs/lib/keyOf');
40
- var setInnerHTML = require('./setInnerHTML');
41
- var setTextContent = require('./setTextContent');
42
43
  var shallowEqual = require('fbjs/lib/shallowEqual');
43
44
  var validateDOMNesting = require('./validateDOMNesting');
44
45
  var warning = require('fbjs/lib/warning');
45
46
 
46
- var deleteListener = ReactBrowserEventEmitter.deleteListener;
47
+ var Flags = ReactDOMComponentFlags;
48
+ var deleteListener = EventPluginHub.deleteListener;
49
+ var getNode = ReactDOMComponentTree.getNodeFromInstance;
47
50
  var listenTo = ReactBrowserEventEmitter.listenTo;
48
- var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
51
+ var registrationNameModules = EventPluginRegistry.registrationNameModules;
49
52
 
50
53
  // For quickly matching children type, to test if can be treated as content.
51
54
  var CONTENT_TYPES = { 'string': true, 'number': true };
52
55
 
53
- var CHILDREN = keyOf({ children: null });
54
56
  var STYLE = keyOf({ style: null });
55
57
  var HTML = keyOf({ __html: null });
56
-
57
- var ELEMENT_NODE_TYPE = 1;
58
+ var RESERVED_PROPS = {
59
+ children: null,
60
+ dangerouslySetInnerHTML: null,
61
+ suppressContentEditableWarning: null
62
+ };
58
63
 
59
64
  function getDeclarationErrorAddendum(internalInstance) {
60
65
  if (internalInstance) {
@@ -69,71 +74,6 @@ function getDeclarationErrorAddendum(internalInstance) {
69
74
  return '';
70
75
  }
71
76
 
72
- var legacyPropsDescriptor;
73
- if (process.env.NODE_ENV !== 'production') {
74
- legacyPropsDescriptor = {
75
- props: {
76
- enumerable: false,
77
- get: function () {
78
- var component = this._reactInternalComponent;
79
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
80
- return component._currentElement.props;
81
- }
82
- }
83
- };
84
- }
85
-
86
- function legacyGetDOMNode() {
87
- if (process.env.NODE_ENV !== 'production') {
88
- var component = this._reactInternalComponent;
89
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
90
- }
91
- return this;
92
- }
93
-
94
- function legacyIsMounted() {
95
- var component = this._reactInternalComponent;
96
- if (process.env.NODE_ENV !== 'production') {
97
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
98
- }
99
- return !!component;
100
- }
101
-
102
- function legacySetStateEtc() {
103
- if (process.env.NODE_ENV !== 'production') {
104
- var component = this._reactInternalComponent;
105
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
106
- }
107
- }
108
-
109
- function legacySetProps(partialProps, callback) {
110
- var component = this._reactInternalComponent;
111
- if (process.env.NODE_ENV !== 'production') {
112
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
113
- }
114
- if (!component) {
115
- return;
116
- }
117
- ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
118
- if (callback) {
119
- ReactUpdateQueue.enqueueCallbackInternal(component, callback);
120
- }
121
- }
122
-
123
- function legacyReplaceProps(partialProps, callback) {
124
- var component = this._reactInternalComponent;
125
- if (process.env.NODE_ENV !== 'production') {
126
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
127
- }
128
- if (!component) {
129
- return;
130
- }
131
- ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
132
- if (callback) {
133
- ReactUpdateQueue.enqueueCallbackInternal(component, callback);
134
- }
135
- }
136
-
137
77
  function friendlyStringify(obj) {
138
78
  if (typeof obj === 'object') {
139
79
  if (Array.isArray(obj)) {
@@ -153,7 +93,7 @@ function friendlyStringify(obj) {
153
93
  } else if (typeof obj === 'function') {
154
94
  return '[function object]';
155
95
  }
156
- // Differs from JSON.stringify in that undefined becauses undefined and that
96
+ // Differs from JSON.stringify in that undefined because undefined and that
157
97
  // inf and nan don't become null
158
98
  return String(obj);
159
99
  }
@@ -183,7 +123,7 @@ function checkAndWarnForMutatedStyle(style1, style2, component) {
183
123
 
184
124
  styleMutationWarning[hash] = true;
185
125
 
186
- process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
126
+ process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0;
187
127
  }
188
128
 
189
129
  /**
@@ -195,35 +135,36 @@ function assertValidProps(component, props) {
195
135
  return;
196
136
  }
197
137
  // Note the use of `==` which checks for null or undefined.
198
- if (process.env.NODE_ENV !== 'production') {
199
- if (voidElementTags[component._tag]) {
200
- process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
201
- }
138
+ if (voidElementTags[component._tag]) {
139
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : invariant(false) : void 0;
202
140
  }
203
141
  if (props.dangerouslySetInnerHTML != null) {
204
- !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
205
- !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
142
+ !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : void 0;
143
+ !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : void 0;
206
144
  }
207
145
  if (process.env.NODE_ENV !== 'production') {
208
- process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
209
- process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
146
+ process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
147
+ process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
148
+ process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0;
210
149
  }
211
- !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
150
+ !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : void 0;
212
151
  }
213
152
 
214
- function enqueuePutListener(id, registrationName, listener, transaction) {
153
+ function enqueuePutListener(inst, registrationName, listener, transaction) {
215
154
  if (process.env.NODE_ENV !== 'production') {
216
155
  // IE8 has no API for event capturing and the `onScroll` event doesn't
217
156
  // bubble.
218
- process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
157
+ process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
219
158
  }
220
- var container = ReactMount.findReactContainerForID(id);
221
- if (container) {
222
- var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
223
- listenTo(registrationName, doc);
159
+ var containerInfo = inst._nativeContainerInfo;
160
+ var doc = containerInfo._ownerDocument;
161
+ if (!doc) {
162
+ // Server rendering.
163
+ return;
224
164
  }
165
+ listenTo(registrationName, doc);
225
166
  transaction.getReactMountReady().enqueue(putListener, {
226
- id: id,
167
+ inst: inst,
227
168
  registrationName: registrationName,
228
169
  listener: listener
229
170
  });
@@ -231,7 +172,7 @@ function enqueuePutListener(id, registrationName, listener, transaction) {
231
172
 
232
173
  function putListener() {
233
174
  var listenerToPut = this;
234
- ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
175
+ EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
235
176
  }
236
177
 
237
178
  // There are so many media events, it makes sense to just
@@ -266,19 +207,20 @@ function trapBubbledEventsLocal() {
266
207
  var inst = this;
267
208
  // If a component renders to null or if another component fatals and causes
268
209
  // the state of the tree to be corrupted, `node` here can be null.
269
- !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
270
- var node = ReactMount.getNode(inst._rootNodeID);
271
- !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
210
+ !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : void 0;
211
+ var node = getNode(inst);
212
+ !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : void 0;
272
213
 
273
214
  switch (inst._tag) {
274
215
  case 'iframe':
216
+ case 'object':
275
217
  inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
276
218
  break;
277
219
  case 'video':
278
220
  case 'audio':
279
221
 
280
222
  inst._wrapperState.listeners = [];
281
- // create listener for each media event
223
+ // Create listener for each media event
282
224
  for (var event in mediaEvents) {
283
225
  if (mediaEvents.hasOwnProperty(event)) {
284
226
  inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
@@ -292,19 +234,20 @@ function trapBubbledEventsLocal() {
292
234
  case 'form':
293
235
  inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
294
236
  break;
237
+ case 'input':
238
+ case 'select':
239
+ case 'textarea':
240
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topInvalid, 'invalid', node)];
241
+ break;
295
242
  }
296
243
  }
297
244
 
298
- function mountReadyInputWrapper() {
299
- ReactDOMInput.mountReadyWrapper(this);
300
- }
301
-
302
245
  function postUpdateSelectWrapper() {
303
246
  ReactDOMSelect.postUpdateWrapper(this);
304
247
  }
305
248
 
306
249
  // For HTML, certain tags should omit their close tag. We keep a whitelist for
307
- // those special cased tags.
250
+ // those special-case tags.
308
251
 
309
252
  var omittedCloseTags = {
310
253
  'area': true,
@@ -334,7 +277,7 @@ var newlineEatingTags = {
334
277
  // For HTML, certain tags cannot have children. This has the same purpose as
335
278
  // `omittedCloseTags` except that `menuitem` should still have its closing tag.
336
279
 
337
- var voidElementTags = assign({
280
+ var voidElementTags = _assign({
338
281
  'menuitem': true
339
282
  }, omittedCloseTags);
340
283
 
@@ -344,27 +287,21 @@ var voidElementTags = assign({
344
287
 
345
288
  var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
346
289
  var validatedTagCache = {};
347
- var hasOwnProperty = ({}).hasOwnProperty;
290
+ var hasOwnProperty = {}.hasOwnProperty;
348
291
 
349
292
  function validateDangerousTag(tag) {
350
293
  if (!hasOwnProperty.call(validatedTagCache, tag)) {
351
- !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
294
+ !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : void 0;
352
295
  validatedTagCache[tag] = true;
353
296
  }
354
297
  }
355
298
 
356
- function processChildContextDev(context, inst) {
357
- // Pass down our tag name to child components for validation purposes
358
- context = assign({}, context);
359
- var info = context[validateDOMNesting.ancestorInfoContextKey];
360
- context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
361
- return context;
362
- }
363
-
364
299
  function isCustomComponent(tagName, props) {
365
300
  return tagName.indexOf('-') >= 0 || props.is != null;
366
301
  }
367
302
 
303
+ var globalIdCounter = 1;
304
+
368
305
  /**
369
306
  * Creates a new React class that is idempotent and capable of containing other
370
307
  * React components. It accepts event listeners and DOM properties that are
@@ -379,19 +316,25 @@ function isCustomComponent(tagName, props) {
379
316
  * @constructor ReactDOMComponent
380
317
  * @extends ReactMultiChild
381
318
  */
382
- function ReactDOMComponent(tag) {
319
+ function ReactDOMComponent(element) {
320
+ var tag = element.type;
383
321
  validateDangerousTag(tag);
322
+ this._currentElement = element;
384
323
  this._tag = tag.toLowerCase();
324
+ this._namespaceURI = null;
385
325
  this._renderedChildren = null;
386
326
  this._previousStyle = null;
387
327
  this._previousStyleCopy = null;
328
+ this._nativeNode = null;
329
+ this._nativeParent = null;
388
330
  this._rootNodeID = null;
331
+ this._domID = null;
332
+ this._nativeContainerInfo = null;
389
333
  this._wrapperState = null;
390
334
  this._topLevelWrapper = null;
391
- this._nodeWithLegacyProperties = null;
335
+ this._flags = 0;
392
336
  if (process.env.NODE_ENV !== 'production') {
393
- this._unprocessedContextDev = null;
394
- this._processedContextDev = null;
337
+ this._ancestorInfo = null;
395
338
  }
396
339
  }
397
340
 
@@ -399,27 +342,28 @@ ReactDOMComponent.displayName = 'ReactDOMComponent';
399
342
 
400
343
  ReactDOMComponent.Mixin = {
401
344
 
402
- construct: function (element) {
403
- this._currentElement = element;
404
- },
405
-
406
345
  /**
407
346
  * Generates root tag markup then recurses. This method has side effects and
408
347
  * is not idempotent.
409
348
  *
410
349
  * @internal
411
- * @param {string} rootID The root DOM ID for this node.
412
350
  * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
351
+ * @param {?ReactDOMComponent} the containing DOM component instance
352
+ * @param {?object} info about the native container
413
353
  * @param {object} context
414
354
  * @return {string} The computed markup.
415
355
  */
416
- mountComponent: function (rootID, transaction, context) {
417
- this._rootNodeID = rootID;
356
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
357
+ this._rootNodeID = globalIdCounter++;
358
+ this._domID = nativeContainerInfo._idCounter++;
359
+ this._nativeParent = nativeParent;
360
+ this._nativeContainerInfo = nativeContainerInfo;
418
361
 
419
362
  var props = this._currentElement.props;
420
363
 
421
364
  switch (this._tag) {
422
365
  case 'iframe':
366
+ case 'object':
423
367
  case 'img':
424
368
  case 'form':
425
369
  case 'video':
@@ -430,50 +374,96 @@ ReactDOMComponent.Mixin = {
430
374
  transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
431
375
  break;
432
376
  case 'button':
433
- props = ReactDOMButton.getNativeProps(this, props, context);
377
+ props = ReactDOMButton.getNativeProps(this, props, nativeParent);
434
378
  break;
435
379
  case 'input':
436
- ReactDOMInput.mountWrapper(this, props, context);
437
- props = ReactDOMInput.getNativeProps(this, props, context);
380
+ ReactDOMInput.mountWrapper(this, props, nativeParent);
381
+ props = ReactDOMInput.getNativeProps(this, props);
382
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
438
383
  break;
439
384
  case 'option':
440
- ReactDOMOption.mountWrapper(this, props, context);
441
- props = ReactDOMOption.getNativeProps(this, props, context);
385
+ ReactDOMOption.mountWrapper(this, props, nativeParent);
386
+ props = ReactDOMOption.getNativeProps(this, props);
442
387
  break;
443
388
  case 'select':
444
- ReactDOMSelect.mountWrapper(this, props, context);
445
- props = ReactDOMSelect.getNativeProps(this, props, context);
446
- context = ReactDOMSelect.processChildContext(this, props, context);
389
+ ReactDOMSelect.mountWrapper(this, props, nativeParent);
390
+ props = ReactDOMSelect.getNativeProps(this, props);
391
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
447
392
  break;
448
393
  case 'textarea':
449
- ReactDOMTextarea.mountWrapper(this, props, context);
450
- props = ReactDOMTextarea.getNativeProps(this, props, context);
394
+ ReactDOMTextarea.mountWrapper(this, props, nativeParent);
395
+ props = ReactDOMTextarea.getNativeProps(this, props);
396
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
451
397
  break;
452
398
  }
453
399
 
454
400
  assertValidProps(this, props);
455
- if (process.env.NODE_ENV !== 'production') {
456
- if (context[validateDOMNesting.ancestorInfoContextKey]) {
457
- validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
401
+
402
+ // We create tags in the namespace of their parent container, except HTML
403
+ // tags get no namespace.
404
+ var namespaceURI;
405
+ var parentTag;
406
+ if (nativeParent != null) {
407
+ namespaceURI = nativeParent._namespaceURI;
408
+ parentTag = nativeParent._tag;
409
+ } else if (nativeContainerInfo._tag) {
410
+ namespaceURI = nativeContainerInfo._namespaceURI;
411
+ parentTag = nativeContainerInfo._tag;
412
+ }
413
+ if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
414
+ namespaceURI = DOMNamespaces.html;
415
+ }
416
+ if (namespaceURI === DOMNamespaces.html) {
417
+ if (this._tag === 'svg') {
418
+ namespaceURI = DOMNamespaces.svg;
419
+ } else if (this._tag === 'math') {
420
+ namespaceURI = DOMNamespaces.mathml;
458
421
  }
459
422
  }
423
+ this._namespaceURI = namespaceURI;
460
424
 
461
425
  if (process.env.NODE_ENV !== 'production') {
462
- this._unprocessedContextDev = context;
463
- this._processedContextDev = processChildContextDev(context, this);
464
- context = this._processedContextDev;
426
+ var parentInfo;
427
+ if (nativeParent != null) {
428
+ parentInfo = nativeParent._ancestorInfo;
429
+ } else if (nativeContainerInfo._tag) {
430
+ parentInfo = nativeContainerInfo._ancestorInfo;
431
+ }
432
+ if (parentInfo) {
433
+ // parentInfo should always be present except for the top-level
434
+ // component when server rendering
435
+ validateDOMNesting(this._tag, this, parentInfo);
436
+ }
437
+ this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
465
438
  }
466
439
 
467
440
  var mountImage;
468
441
  if (transaction.useCreateElement) {
469
- var ownerDocument = context[ReactMount.ownerDocumentContextKey];
470
- var el = ownerDocument.createElement(this._currentElement.type);
471
- DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
472
- // Populate node cache
473
- ReactMount.getID(el);
474
- this._updateDOMProperties({}, props, transaction, el);
475
- this._createInitialChildren(transaction, props, context, el);
476
- mountImage = el;
442
+ var ownerDocument = nativeContainerInfo._ownerDocument;
443
+ var el;
444
+ if (namespaceURI === DOMNamespaces.html) {
445
+ if (this._tag === 'script') {
446
+ // Create the script via .innerHTML so its "parser-inserted" flag is
447
+ // set to true and it does not execute
448
+ var div = ownerDocument.createElement('div');
449
+ var type = this._currentElement.type;
450
+ div.innerHTML = '<' + type + '></' + type + '>';
451
+ el = div.removeChild(div.firstChild);
452
+ } else {
453
+ el = ownerDocument.createElement(this._currentElement.type);
454
+ }
455
+ } else {
456
+ el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
457
+ }
458
+ ReactDOMComponentTree.precacheNode(this, el);
459
+ this._flags |= Flags.hasCachedChildNodes;
460
+ if (!this._nativeParent) {
461
+ DOMPropertyOperations.setAttributeForRoot(el);
462
+ }
463
+ this._updateDOMProperties(null, props, transaction);
464
+ var lazyTree = DOMLazyTree(el);
465
+ this._createInitialChildren(transaction, props, context, lazyTree);
466
+ mountImage = lazyTree;
477
467
  } else {
478
468
  var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
479
469
  var tagContent = this._createContentMarkup(transaction, props, context);
@@ -485,10 +475,8 @@ ReactDOMComponent.Mixin = {
485
475
  }
486
476
 
487
477
  switch (this._tag) {
488
- case 'input':
489
- transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
490
- // falls through
491
478
  case 'button':
479
+ case 'input':
492
480
  case 'select':
493
481
  case 'textarea':
494
482
  if (props.autoFocus) {
@@ -526,7 +514,7 @@ ReactDOMComponent.Mixin = {
526
514
  }
527
515
  if (registrationNameModules.hasOwnProperty(propKey)) {
528
516
  if (propValue) {
529
- enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
517
+ enqueuePutListener(this, propKey, propValue, transaction);
530
518
  }
531
519
  } else {
532
520
  if (propKey === STYLE) {
@@ -535,13 +523,13 @@ ReactDOMComponent.Mixin = {
535
523
  // See `_updateDOMProperties`. style block
536
524
  this._previousStyle = propValue;
537
525
  }
538
- propValue = this._previousStyleCopy = assign({}, props.style);
526
+ propValue = this._previousStyleCopy = _assign({}, props.style);
539
527
  }
540
- propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
528
+ propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
541
529
  }
542
530
  var markup = null;
543
531
  if (this._tag != null && isCustomComponent(this._tag, props)) {
544
- if (propKey !== CHILDREN) {
532
+ if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
545
533
  markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
546
534
  }
547
535
  } else {
@@ -559,8 +547,11 @@ ReactDOMComponent.Mixin = {
559
547
  return ret;
560
548
  }
561
549
 
562
- var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
563
- return ret + ' ' + markupForID;
550
+ if (!this._nativeParent) {
551
+ ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
552
+ }
553
+ ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
554
+ return ret;
564
555
  },
565
556
 
566
557
  /**
@@ -609,23 +600,23 @@ ReactDOMComponent.Mixin = {
609
600
  }
610
601
  },
611
602
 
612
- _createInitialChildren: function (transaction, props, context, el) {
603
+ _createInitialChildren: function (transaction, props, context, lazyTree) {
613
604
  // Intentional use of != to avoid catching zero/false.
614
605
  var innerHTML = props.dangerouslySetInnerHTML;
615
606
  if (innerHTML != null) {
616
607
  if (innerHTML.__html != null) {
617
- setInnerHTML(el, innerHTML.__html);
608
+ DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
618
609
  }
619
610
  } else {
620
611
  var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
621
612
  var childrenToUse = contentToUse != null ? null : props.children;
622
613
  if (contentToUse != null) {
623
614
  // TODO: Validate that text is allowed as a child of this node
624
- setTextContent(el, contentToUse);
615
+ DOMLazyTree.queueText(lazyTree, contentToUse);
625
616
  } else if (childrenToUse != null) {
626
617
  var mountImages = this.mountChildren(childrenToUse, transaction, context);
627
618
  for (var i = 0; i < mountImages.length; i++) {
628
- el.appendChild(mountImages[i]);
619
+ DOMLazyTree.queueChild(lazyTree, mountImages[i]);
629
620
  }
630
621
  }
631
622
  }
@@ -684,25 +675,10 @@ ReactDOMComponent.Mixin = {
684
675
  break;
685
676
  }
686
677
 
687
- if (process.env.NODE_ENV !== 'production') {
688
- // If the context is reference-equal to the old one, pass down the same
689
- // processed object so the update bailout in ReactReconciler behaves
690
- // correctly (and identically in dev and prod). See #5005.
691
- if (this._unprocessedContextDev !== context) {
692
- this._unprocessedContextDev = context;
693
- this._processedContextDev = processChildContextDev(context, this);
694
- }
695
- context = this._processedContextDev;
696
- }
697
-
698
678
  assertValidProps(this, nextProps);
699
- this._updateDOMProperties(lastProps, nextProps, transaction, null);
679
+ this._updateDOMProperties(lastProps, nextProps, transaction);
700
680
  this._updateDOMChildren(lastProps, nextProps, transaction, context);
701
681
 
702
- if (!canDefineProperty && this._nodeWithLegacyProperties) {
703
- this._nodeWithLegacyProperties.props = nextProps;
704
- }
705
-
706
682
  if (this._tag === 'select') {
707
683
  // <select> value update needs to occur after <option> children
708
684
  // reconciliation
@@ -724,15 +700,14 @@ ReactDOMComponent.Mixin = {
724
700
  * @private
725
701
  * @param {object} lastProps
726
702
  * @param {object} nextProps
727
- * @param {ReactReconcileTransaction} transaction
728
703
  * @param {?DOMElement} node
729
704
  */
730
- _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
705
+ _updateDOMProperties: function (lastProps, nextProps, transaction) {
731
706
  var propKey;
732
707
  var styleName;
733
708
  var styleUpdates;
734
709
  for (propKey in lastProps) {
735
- if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
710
+ if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
736
711
  continue;
737
712
  }
738
713
  if (propKey === STYLE) {
@@ -749,19 +724,16 @@ ReactDOMComponent.Mixin = {
749
724
  // Only call deleteListener if there was a listener previously or
750
725
  // else willDeleteListener gets called when there wasn't actually a
751
726
  // listener (e.g., onClick={null})
752
- deleteListener(this._rootNodeID, propKey);
727
+ deleteListener(this, propKey);
753
728
  }
754
729
  } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
755
- if (!node) {
756
- node = ReactMount.getNode(this._rootNodeID);
757
- }
758
- DOMPropertyOperations.deleteValueForProperty(node, propKey);
730
+ DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
759
731
  }
760
732
  }
761
733
  for (propKey in nextProps) {
762
734
  var nextProp = nextProps[propKey];
763
- var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
764
- if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
735
+ var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
736
+ if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
765
737
  continue;
766
738
  }
767
739
  if (propKey === STYLE) {
@@ -770,7 +742,7 @@ ReactDOMComponent.Mixin = {
770
742
  checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
771
743
  this._previousStyle = nextProp;
772
744
  }
773
- nextProp = this._previousStyleCopy = assign({}, nextProp);
745
+ nextProp = this._previousStyleCopy = _assign({}, nextProp);
774
746
  } else {
775
747
  this._previousStyleCopy = null;
776
748
  }
@@ -795,24 +767,18 @@ ReactDOMComponent.Mixin = {
795
767
  }
796
768
  } else if (registrationNameModules.hasOwnProperty(propKey)) {
797
769
  if (nextProp) {
798
- enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
770
+ enqueuePutListener(this, propKey, nextProp, transaction);
799
771
  } else if (lastProp) {
800
- deleteListener(this._rootNodeID, propKey);
772
+ deleteListener(this, propKey);
801
773
  }
802
774
  } else if (isCustomComponent(this._tag, nextProps)) {
803
- if (!node) {
804
- node = ReactMount.getNode(this._rootNodeID);
805
- }
806
- if (propKey === CHILDREN) {
807
- nextProp = null;
775
+ if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
776
+ DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
808
777
  }
809
- DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
810
778
  } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
811
- if (!node) {
812
- node = ReactMount.getNode(this._rootNodeID);
813
- }
779
+ var node = getNode(this);
814
780
  // If we're updating to null or undefined, we should remove the property
815
- // from the DOM node instead of inadvertantly setting to a string. This
781
+ // from the DOM node instead of inadvertently setting to a string. This
816
782
  // brings us in line with the same behavior we have on initial render.
817
783
  if (nextProp != null) {
818
784
  DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
@@ -822,10 +788,7 @@ ReactDOMComponent.Mixin = {
822
788
  }
823
789
  }
824
790
  if (styleUpdates) {
825
- if (!node) {
826
- node = ReactMount.getNode(this._rootNodeID);
827
- }
828
- CSSPropertyOperations.setValueForStyles(node, styleUpdates);
791
+ CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
829
792
  }
830
793
  },
831
794
 
@@ -872,15 +835,20 @@ ReactDOMComponent.Mixin = {
872
835
  }
873
836
  },
874
837
 
838
+ getNativeNode: function () {
839
+ return getNode(this);
840
+ },
841
+
875
842
  /**
876
843
  * Destroys all event registrations for this instance. Does not remove from
877
844
  * the DOM. That must be done by the parent.
878
845
  *
879
846
  * @internal
880
847
  */
881
- unmountComponent: function () {
848
+ unmountComponent: function (safely) {
882
849
  switch (this._tag) {
883
850
  case 'iframe':
851
+ case 'object':
884
852
  case 'img':
885
853
  case 'form':
886
854
  case 'video':
@@ -892,9 +860,6 @@ ReactDOMComponent.Mixin = {
892
860
  }
893
861
  }
894
862
  break;
895
- case 'input':
896
- ReactDOMInput.unmountWrapper(this);
897
- break;
898
863
  case 'html':
899
864
  case 'head':
900
865
  case 'body':
@@ -904,59 +869,30 @@ ReactDOMComponent.Mixin = {
904
869
  * take advantage of React's reconciliation for styling and <title>
905
870
  * management. So we just document it and throw in dangerous cases.
906
871
  */
907
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
872
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : void 0;
908
873
  break;
909
874
  }
910
875
 
911
- this.unmountChildren();
912
- ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
876
+ this.unmountChildren(safely);
877
+ ReactDOMComponentTree.uncacheNode(this);
878
+ EventPluginHub.deleteAllListeners(this);
913
879
  ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
914
880
  this._rootNodeID = null;
881
+ this._domID = null;
915
882
  this._wrapperState = null;
916
- if (this._nodeWithLegacyProperties) {
917
- var node = this._nodeWithLegacyProperties;
918
- node._reactInternalComponent = null;
919
- this._nodeWithLegacyProperties = null;
920
- }
921
883
  },
922
884
 
923
885
  getPublicInstance: function () {
924
- if (!this._nodeWithLegacyProperties) {
925
- var node = ReactMount.getNode(this._rootNodeID);
926
-
927
- node._reactInternalComponent = this;
928
- node.getDOMNode = legacyGetDOMNode;
929
- node.isMounted = legacyIsMounted;
930
- node.setState = legacySetStateEtc;
931
- node.replaceState = legacySetStateEtc;
932
- node.forceUpdate = legacySetStateEtc;
933
- node.setProps = legacySetProps;
934
- node.replaceProps = legacyReplaceProps;
935
-
936
- if (process.env.NODE_ENV !== 'production') {
937
- if (canDefineProperty) {
938
- Object.defineProperties(node, legacyPropsDescriptor);
939
- } else {
940
- // updateComponent will update this property on subsequent renders
941
- node.props = this._currentElement.props;
942
- }
943
- } else {
944
- // updateComponent will update this property on subsequent renders
945
- node.props = this._currentElement.props;
946
- }
947
-
948
- this._nodeWithLegacyProperties = node;
949
- }
950
- return this._nodeWithLegacyProperties;
886
+ return getNode(this);
951
887
  }
952
888
 
953
889
  };
954
890
 
955
- ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
891
+ ReactPerf.measureMethods(ReactDOMComponent.Mixin, 'ReactDOMComponent', {
956
892
  mountComponent: 'mountComponent',
957
- updateComponent: 'updateComponent'
893
+ receiveComponent: 'receiveComponent'
958
894
  });
959
895
 
960
- assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
896
+ _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
961
897
 
962
898
  module.exports = ReactDOMComponent;