react 0.14.8 → 15.0.0-rc.1

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 (184) hide show
  1. package/LICENSE +1 -1
  2. package/addons.js +2 -0
  3. package/dist/react-with-addons.js +4203 -4148
  4. package/dist/react-with-addons.min.js +7 -7
  5. package/dist/react.js +4159 -3850
  6. package/dist/react.min.js +7 -7
  7. package/lib/AutoFocusUtils.js +3 -15
  8. package/lib/BeforeInputEventPlugin.js +8 -25
  9. package/lib/CSSProperty.js +4 -1
  10. package/lib/CSSPropertyOperations.js +24 -10
  11. package/lib/CallbackQueue.js +13 -2
  12. package/lib/ChangeEventPlugin.js +58 -54
  13. package/lib/DOMChildrenOperations.js +93 -60
  14. package/lib/DOMLazyTree.js +96 -0
  15. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  16. package/lib/DOMProperty.js +18 -39
  17. package/lib/DOMPropertyOperations.js +87 -53
  18. package/lib/Danger.js +13 -14
  19. package/lib/DefaultEventPluginOrder.js +1 -1
  20. package/lib/EnterLeaveEventPlugin.js +24 -43
  21. package/lib/EventConstants.js +6 -1
  22. package/lib/EventPluginHub.js +22 -66
  23. package/lib/EventPluginRegistry.js +30 -9
  24. package/lib/EventPluginUtils.js +61 -36
  25. package/lib/EventPropagators.js +19 -17
  26. package/lib/FallbackCompositionState.js +1 -2
  27. package/lib/HTMLDOMPropertyConfig.js +69 -90
  28. package/lib/LinkedStateMixin.js +1 -2
  29. package/lib/LinkedValueUtils.js +5 -6
  30. package/lib/MetaMatchers.js +2 -2
  31. package/lib/Object.assign.js +1 -1
  32. package/lib/OrderedMap.js +14 -14
  33. package/lib/PooledClass.js +2 -2
  34. package/lib/React.js +1 -13
  35. package/lib/ReactBrowserEventEmitter.js +16 -24
  36. package/lib/ReactCSSTransitionGroup.js +1 -2
  37. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  38. package/lib/ReactChildReconciler.js +15 -13
  39. package/lib/ReactChildren.js +5 -4
  40. package/lib/ReactClass.js +37 -86
  41. package/lib/ReactComponent.js +7 -8
  42. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  43. package/lib/ReactComponentEnvironment.js +4 -4
  44. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  45. package/lib/ReactCompositeComponent.js +160 -69
  46. package/lib/ReactCurrentOwner.js +2 -1
  47. package/lib/ReactDOM.js +27 -15
  48. package/lib/ReactDOMButton.js +2 -2
  49. package/lib/ReactDOMComponent.js +188 -244
  50. package/lib/ReactDOMComponentFlags.js +18 -0
  51. package/lib/ReactDOMComponentTree.js +186 -0
  52. package/lib/ReactDOMContainerInfo.js +32 -0
  53. package/lib/ReactDOMDebugTool.js +69 -0
  54. package/lib/ReactDOMEmptyComponent.js +60 -0
  55. package/lib/ReactDOMFactories.js +1 -2
  56. package/lib/ReactDOMFeatureFlags.js +2 -2
  57. package/lib/ReactDOMIDOperations.js +5 -60
  58. package/lib/ReactDOMInput.js +71 -22
  59. package/lib/ReactDOMInstrumentation.js +16 -0
  60. package/lib/ReactDOMOption.js +11 -10
  61. package/lib/ReactDOMSVGDeprecatedAttributeDevtool.js +61 -0
  62. package/lib/ReactDOMSelect.js +40 -17
  63. package/lib/ReactDOMSelection.js +4 -4
  64. package/lib/ReactDOMServer.js +1 -1
  65. package/lib/ReactDOMTextComponent.js +84 -43
  66. package/lib/ReactDOMTextarea.js +36 -9
  67. package/lib/ReactDOMTreeTraversal.js +134 -0
  68. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  69. package/lib/ReactDebugTool.js +72 -0
  70. package/lib/ReactDefaultBatchingStrategy.js +1 -1
  71. package/lib/ReactDefaultInjection.js +11 -15
  72. package/lib/ReactDefaultPerf.js +59 -19
  73. package/lib/ReactDefaultPerfAnalysis.js +17 -9
  74. package/lib/ReactElement.js +60 -21
  75. package/lib/ReactElementValidator.js +8 -8
  76. package/lib/ReactEmptyComponent.js +8 -33
  77. package/lib/ReactErrorUtils.js +1 -2
  78. package/lib/ReactEventEmitterMixin.js +3 -8
  79. package/lib/ReactEventListener.js +20 -75
  80. package/lib/ReactFeatureFlags.js +21 -0
  81. package/lib/ReactFragment.js +6 -6
  82. package/lib/ReactInjection.js +3 -3
  83. package/lib/ReactInputSelection.js +4 -4
  84. package/lib/ReactInstanceHandles.js +10 -12
  85. package/lib/ReactInstanceMap.js +2 -1
  86. package/lib/ReactInstrumentation.js +16 -0
  87. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  88. package/lib/ReactIsomorphic.js +1 -1
  89. package/lib/ReactLink.js +2 -3
  90. package/lib/ReactMarkupChecksum.js +1 -1
  91. package/lib/ReactMount.js +87 -460
  92. package/lib/ReactMultiChild.js +106 -200
  93. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  94. package/lib/ReactNativeComponent.js +3 -3
  95. package/lib/ReactNodeTypes.js +37 -0
  96. package/lib/ReactNoopUpdateQueue.js +2 -25
  97. package/lib/ReactOwner.js +3 -3
  98. package/lib/ReactPerf.js +2 -2
  99. package/lib/ReactPropTransferer.js +1 -1
  100. package/lib/ReactPropTypeLocationNames.js +1 -1
  101. package/lib/ReactPropTypeLocations.js +1 -1
  102. package/lib/ReactPropTypes.js +27 -3
  103. package/lib/ReactReconcileTransaction.js +17 -6
  104. package/lib/ReactReconciler.js +29 -6
  105. package/lib/ReactRef.js +1 -1
  106. package/lib/ReactServerBatchingStrategy.js +1 -2
  107. package/lib/ReactServerRendering.js +17 -35
  108. package/lib/ReactServerRenderingTransaction.js +8 -26
  109. package/lib/ReactSimpleEmptyComponent.js +36 -0
  110. package/lib/ReactStateSetters.js +1 -1
  111. package/lib/ReactTestUtils.js +33 -24
  112. package/lib/ReactTransitionChildMapping.js +1 -2
  113. package/lib/ReactTransitionEvents.js +8 -44
  114. package/lib/ReactTransitionGroup.js +1 -1
  115. package/lib/ReactUpdateQueue.js +6 -65
  116. package/lib/ReactUpdates.js +26 -9
  117. package/lib/ReactVersion.js +2 -2
  118. package/lib/ReactWithAddons.js +1 -14
  119. package/lib/ResponderEventPlugin.js +54 -66
  120. package/lib/ResponderSyntheticEvent.js +1 -2
  121. package/lib/ResponderTouchHistoryStore.js +5 -5
  122. package/lib/SVGDOMPropertyConfig.js +25 -66
  123. package/lib/SelectEventPlugin.js +13 -18
  124. package/lib/SimpleEventPlugin.js +57 -17
  125. package/lib/SyntheticAnimationEvent.js +39 -0
  126. package/lib/SyntheticClipboardEvent.js +2 -3
  127. package/lib/SyntheticCompositionEvent.js +2 -3
  128. package/lib/SyntheticDragEvent.js +2 -3
  129. package/lib/SyntheticEvent.js +97 -17
  130. package/lib/SyntheticFocusEvent.js +2 -3
  131. package/lib/SyntheticInputEvent.js +2 -3
  132. package/lib/SyntheticKeyboardEvent.js +2 -3
  133. package/lib/SyntheticMouseEvent.js +2 -3
  134. package/lib/SyntheticTouchEvent.js +2 -3
  135. package/lib/SyntheticTransitionEvent.js +39 -0
  136. package/lib/SyntheticUIEvent.js +2 -3
  137. package/lib/SyntheticWheelEvent.js +2 -3
  138. package/lib/TapEventPlugin.js +3 -12
  139. package/lib/Transaction.js +3 -3
  140. package/lib/ViewportMetrics.js +1 -1
  141. package/lib/accumulate.js +2 -2
  142. package/lib/accumulateInto.js +2 -2
  143. package/lib/adler32.js +3 -2
  144. package/lib/canDefineProperty.js +1 -1
  145. package/lib/createHierarchyRenderer.js +1 -1
  146. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  147. package/lib/dangerousStyleValue.js +25 -3
  148. package/lib/deprecated.js +4 -2
  149. package/lib/escapeTextContentForBrowser.js +1 -1
  150. package/lib/findDOMNode.js +15 -8
  151. package/lib/flattenChildren.js +2 -2
  152. package/lib/forEachAccumulated.js +2 -1
  153. package/lib/getEventCharCode.js +2 -2
  154. package/lib/getEventKey.js +1 -2
  155. package/lib/getEventModifierState.js +1 -2
  156. package/lib/getEventTarget.js +8 -2
  157. package/lib/getIteratorFn.js +2 -2
  158. package/lib/getNativeComponentFromComposite.js +30 -0
  159. package/lib/getNodeForCharacterOffset.js +2 -1
  160. package/lib/getTestDocument.js +1 -1
  161. package/lib/getTextContentAccessor.js +1 -1
  162. package/lib/getVendorPrefixedEventName.js +101 -0
  163. package/lib/instantiateReactComponent.js +9 -11
  164. package/lib/isEventSupported.js +2 -2
  165. package/lib/isTextInputElement.js +2 -1
  166. package/lib/onlyChild.js +2 -2
  167. package/lib/quoteAttributeValueForBrowser.js +1 -1
  168. package/lib/reactComponentExpect.js +2 -2
  169. package/lib/renderSubtreeIntoContainer.js +1 -1
  170. package/lib/setInnerHTML.js +5 -14
  171. package/lib/setTextContent.js +1 -1
  172. package/lib/shallowCompare.js +1 -1
  173. package/lib/shouldUpdateReactComponent.js +2 -3
  174. package/lib/sliceChildren.js +1 -1
  175. package/lib/traverseAllChildren.js +8 -8
  176. package/lib/update.js +12 -12
  177. package/lib/validateDOMNesting.js +15 -11
  178. package/package.json +2 -2
  179. package/lib/ReactBrowserComponentMixin.js +0 -36
  180. package/lib/ReactEmptyComponentRegistry.js +0 -48
  181. package/lib/ReactRootIndex.js +0 -29
  182. package/lib/ServerReactRootIndex.js +0 -29
  183. package/lib/cloneWithProps.js +0 -54
  184. 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
@@ -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,19 +7,18 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactDOMTextComponent
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 ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
18
- var ReactMount = require('./ReactMount');
15
+ var DOMLazyTree = require('./DOMLazyTree');
16
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
17
+ var ReactPerf = require('./ReactPerf');
19
18
 
20
19
  var assign = require('./Object.assign');
21
20
  var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
22
- var setTextContent = require('./setTextContent');
21
+ var invariant = require('fbjs/lib/invariant');
23
22
  var validateDOMNesting = require('./validateDOMNesting');
24
23
 
25
24
  /**
@@ -28,8 +27,8 @@ var validateDOMNesting = require('./validateDOMNesting');
28
27
  * - When mounting text into the DOM, adjacent text nodes are merged.
29
28
  * - Text nodes cannot be assigned a React root ID.
30
29
  *
31
- * This component is used to wrap strings in elements so that they can undergo
32
- * the same reconciliation that is applied to elements.
30
+ * This component is used to wrap strings between comment nodes so that they
31
+ * can undergo the same reconciliation that is applied to elements.
33
32
  *
34
33
  * TODO: Investigate representing React components in the DOM with text nodes.
35
34
  *
@@ -37,62 +36,75 @@ var validateDOMNesting = require('./validateDOMNesting');
37
36
  * @extends ReactComponent
38
37
  * @internal
39
38
  */
40
- var ReactDOMTextComponent = function (props) {
41
- // This constructor and its argument is currently used by mocks.
39
+ var ReactDOMTextComponent = function (text) {
40
+ // TODO: This is really a ReactText (ReactNode), not a ReactElement
41
+ this._currentElement = text;
42
+ this._stringText = '' + text;
43
+ // ReactDOMComponentTree uses these:
44
+ this._nativeNode = null;
45
+ this._nativeParent = null;
46
+
47
+ // Properties
48
+ this._domID = null;
49
+ this._mountIndex = 0;
50
+ this._closingComment = null;
51
+ this._commentNodes = null;
42
52
  };
43
53
 
44
54
  assign(ReactDOMTextComponent.prototype, {
45
55
 
46
- /**
47
- * @param {ReactText} text
48
- * @internal
49
- */
50
- construct: function (text) {
51
- // TODO: This is really a ReactText (ReactNode), not a ReactElement
52
- this._currentElement = text;
53
- this._stringText = '' + text;
54
-
55
- // Properties
56
- this._rootNodeID = null;
57
- this._mountIndex = 0;
58
- },
59
-
60
56
  /**
61
57
  * Creates the markup for this text node. This node is not intended to have
62
58
  * any features besides containing text content.
63
59
  *
64
- * @param {string} rootID DOM ID of the root node.
65
60
  * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
66
61
  * @return {string} Markup for this text node.
67
62
  * @internal
68
63
  */
69
- mountComponent: function (rootID, transaction, context) {
64
+ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
70
65
  if (process.env.NODE_ENV !== 'production') {
71
- if (context[validateDOMNesting.ancestorInfoContextKey]) {
72
- validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
66
+ var parentInfo;
67
+ if (nativeParent != null) {
68
+ parentInfo = nativeParent._ancestorInfo;
69
+ } else if (nativeContainerInfo != null) {
70
+ parentInfo = nativeContainerInfo._ancestorInfo;
71
+ }
72
+ if (parentInfo) {
73
+ // parentInfo should always be present except for the top-level
74
+ // component when server rendering
75
+ validateDOMNesting('#text', this, parentInfo);
73
76
  }
74
77
  }
75
78
 
76
- this._rootNodeID = rootID;
79
+ var domID = nativeContainerInfo._idCounter++;
80
+ var openingValue = ' react-text: ' + domID + ' ';
81
+ var closingValue = ' /react-text ';
82
+ this._domID = domID;
83
+ this._nativeParent = nativeParent;
77
84
  if (transaction.useCreateElement) {
78
- var ownerDocument = context[ReactMount.ownerDocumentContextKey];
79
- var el = ownerDocument.createElement('span');
80
- DOMPropertyOperations.setAttributeForID(el, rootID);
81
- // Populate node cache
82
- ReactMount.getID(el);
83
- setTextContent(el, this._stringText);
84
- return el;
85
+ var ownerDocument = nativeContainerInfo._ownerDocument;
86
+ var openingComment = ownerDocument.createComment(openingValue);
87
+ var closingComment = ownerDocument.createComment(closingValue);
88
+ var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
89
+ DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
90
+ if (this._stringText) {
91
+ DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
92
+ }
93
+ DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
94
+ ReactDOMComponentTree.precacheNode(this, openingComment);
95
+ this._closingComment = closingComment;
96
+ return lazyTree;
85
97
  } else {
86
98
  var escapedText = escapeTextContentForBrowser(this._stringText);
87
99
 
88
100
  if (transaction.renderToStaticMarkup) {
89
- // Normally we'd wrap this in a `span` for the reasons stated above, but
90
- // since this is a situation where React won't take over (static pages),
91
- // we can simply return the text as it is.
101
+ // Normally we'd wrap this between comment nodes for the reasons stated
102
+ // above, but since this is a situation where React won't take over
103
+ // (static pages), we can simply return the text as it is.
92
104
  return escapedText;
93
105
  }
94
106
 
95
- return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
107
+ return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
96
108
  }
97
109
  },
98
110
 
@@ -112,16 +124,45 @@ assign(ReactDOMTextComponent.prototype, {
112
124
  // and/or updateComponent to do the actual update for consistency with
113
125
  // other component types?
114
126
  this._stringText = nextStringText;
115
- var node = ReactMount.getNode(this._rootNodeID);
116
- DOMChildrenOperations.updateTextContent(node, nextStringText);
127
+ var commentNodes = this.getNativeNode();
128
+ DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
117
129
  }
118
130
  }
119
131
  },
120
132
 
133
+ getNativeNode: function () {
134
+ var nativeNode = this._commentNodes;
135
+ if (nativeNode) {
136
+ return nativeNode;
137
+ }
138
+ if (!this._closingComment) {
139
+ var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
140
+ var node = openingComment.nextSibling;
141
+ while (true) {
142
+ !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : invariant(false) : void 0;
143
+ if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
144
+ this._closingComment = node;
145
+ break;
146
+ }
147
+ node = node.nextSibling;
148
+ }
149
+ }
150
+ nativeNode = [this._nativeNode, this._closingComment];
151
+ this._commentNodes = nativeNode;
152
+ return nativeNode;
153
+ },
154
+
121
155
  unmountComponent: function () {
122
- ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
156
+ this._closingComment = null;
157
+ this._commentNodes = null;
158
+ ReactDOMComponentTree.uncacheNode(this);
123
159
  }
124
160
 
125
161
  });
126
162
 
163
+ ReactPerf.measureMethods(ReactDOMTextComponent.prototype, 'ReactDOMTextComponent', {
164
+ mountComponent: 'mountComponent',
165
+ receiveComponent: 'receiveComponent'
166
+ });
167
+
127
168
  module.exports = ReactDOMTextComponent;
@@ -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
@@ -11,14 +11,19 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var DOMPropertyOperations = require('./DOMPropertyOperations');
14
15
  var LinkedValueUtils = require('./LinkedValueUtils');
15
- var ReactDOMIDOperations = require('./ReactDOMIDOperations');
16
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
16
17
  var ReactUpdates = require('./ReactUpdates');
17
18
 
18
19
  var assign = require('./Object.assign');
19
20
  var invariant = require('fbjs/lib/invariant');
20
21
  var warning = require('fbjs/lib/warning');
21
22
 
23
+ var didWarnValueLink = false;
24
+ var didWarnValueNull = false;
25
+ var didWarnValDefaultVal = false;
26
+
22
27
  function forceUpdateIfMounted() {
23
28
  if (this._rootNodeID) {
24
29
  // DOM component is still mounted; update
@@ -26,6 +31,14 @@ function forceUpdateIfMounted() {
26
31
  }
27
32
  }
28
33
 
34
+ function warnIfValueIsNull(props) {
35
+ if (props != null && props.value === null && !didWarnValueNull) {
36
+ process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `textarea` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
37
+
38
+ didWarnValueNull = true;
39
+ }
40
+ }
41
+
29
42
  /**
30
43
  * Implements a <textarea> native component that allows setting `value`, and
31
44
  * `defaultValue`. This differs from the traditional DOM API because value is
@@ -42,8 +55,8 @@ function forceUpdateIfMounted() {
42
55
  * `defaultValue` if specified, or the children content (deprecated).
43
56
  */
44
57
  var ReactDOMTextarea = {
45
- getNativeProps: function (inst, props, context) {
46
- !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
58
+ getNativeProps: function (inst, props) {
59
+ !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : void 0;
47
60
 
48
61
  // Always set children to the same thing. In IE9, the selection range will
49
62
  // get reset if `textContent` is mutated.
@@ -60,6 +73,15 @@ var ReactDOMTextarea = {
60
73
  mountWrapper: function (inst, props) {
61
74
  if (process.env.NODE_ENV !== 'production') {
62
75
  LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
76
+ if (props.valueLink !== undefined && !didWarnValueLink) {
77
+ process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
78
+ didWarnValueLink = true;
79
+ }
80
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
81
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
82
+ didWarnValDefaultVal = true;
83
+ }
84
+ warnIfValueIsNull(props);
63
85
  }
64
86
 
65
87
  var defaultValue = props.defaultValue;
@@ -67,11 +89,11 @@ var ReactDOMTextarea = {
67
89
  var children = props.children;
68
90
  if (children != null) {
69
91
  if (process.env.NODE_ENV !== 'production') {
70
- process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
92
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
71
93
  }
72
- !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
94
+ !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : void 0;
73
95
  if (Array.isArray(children)) {
74
- !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
96
+ !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : void 0;
75
97
  children = children[0];
76
98
  }
77
99
 
@@ -81,24 +103,29 @@ var ReactDOMTextarea = {
81
103
  defaultValue = '';
82
104
  }
83
105
  var value = LinkedValueUtils.getValue(props);
84
-
85
106
  inst._wrapperState = {
86
107
  // We save the initial value so that `ReactDOMComponent` doesn't update
87
108
  // `textContent` (unnecessary since we update value).
88
109
  // The initial value can be a boolean or object so that's why it's
89
110
  // forced to be a string.
90
111
  initialValue: '' + (value != null ? value : defaultValue),
112
+ listeners: null,
91
113
  onChange: _handleChange.bind(inst)
92
114
  };
93
115
  },
94
116
 
95
117
  updateWrapper: function (inst) {
96
118
  var props = inst._currentElement.props;
119
+
120
+ if (process.env.NODE_ENV !== 'production') {
121
+ warnIfValueIsNull(props);
122
+ }
123
+
97
124
  var value = LinkedValueUtils.getValue(props);
98
125
  if (value != null) {
99
126
  // Cast `value` to a string to ensure the value is set correctly. While
100
127
  // browsers typically do this as necessary, jsdom doesn't.
101
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
128
+ DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'value', '' + value);
102
129
  }
103
130
  }
104
131
  };
@@ -0,0 +1,134 @@
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 ReactDOMTreeTraversal
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var invariant = require('fbjs/lib/invariant');
15
+
16
+ /**
17
+ * Return the lowest common ancestor of A and B, or null if they are in
18
+ * different trees.
19
+ */
20
+ function getLowestCommonAncestor(instA, instB) {
21
+ !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
22
+ !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
23
+
24
+ var depthA = 0;
25
+ for (var tempA = instA; tempA; tempA = tempA._nativeParent) {
26
+ depthA++;
27
+ }
28
+ var depthB = 0;
29
+ for (var tempB = instB; tempB; tempB = tempB._nativeParent) {
30
+ depthB++;
31
+ }
32
+
33
+ // If A is deeper, crawl up.
34
+ while (depthA - depthB > 0) {
35
+ instA = instA._nativeParent;
36
+ depthA--;
37
+ }
38
+
39
+ // If B is deeper, crawl up.
40
+ while (depthB - depthA > 0) {
41
+ instB = instB._nativeParent;
42
+ depthB--;
43
+ }
44
+
45
+ // Walk in lockstep until we find a match.
46
+ var depth = depthA;
47
+ while (depth--) {
48
+ if (instA === instB) {
49
+ return instA;
50
+ }
51
+ instA = instA._nativeParent;
52
+ instB = instB._nativeParent;
53
+ }
54
+ return null;
55
+ }
56
+
57
+ /**
58
+ * Return if A is an ancestor of B.
59
+ */
60
+ function isAncestor(instA, instB) {
61
+ !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : void 0;
62
+ !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : void 0;
63
+
64
+ while (instB) {
65
+ if (instB === instA) {
66
+ return true;
67
+ }
68
+ instB = instB._nativeParent;
69
+ }
70
+ return false;
71
+ }
72
+
73
+ /**
74
+ * Return the parent instance of the passed-in instance.
75
+ */
76
+ function getParentInstance(inst) {
77
+ !('_nativeNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : invariant(false) : void 0;
78
+
79
+ return inst._nativeParent;
80
+ }
81
+
82
+ /**
83
+ * Simulates the traversal of a two-phase, capture/bubble event dispatch.
84
+ */
85
+ function traverseTwoPhase(inst, fn, arg) {
86
+ var path = [];
87
+ while (inst) {
88
+ path.push(inst);
89
+ inst = inst._nativeParent;
90
+ }
91
+ var i;
92
+ for (i = path.length; i-- > 0;) {
93
+ fn(path[i], false, arg);
94
+ }
95
+ for (i = 0; i < path.length; i++) {
96
+ fn(path[i], true, arg);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
102
+ * should would receive a `mouseEnter` or `mouseLeave` event.
103
+ *
104
+ * Does not invoke the callback on the nearest common ancestor because nothing
105
+ * "entered" or "left" that element.
106
+ */
107
+ function traverseEnterLeave(from, to, fn, argFrom, argTo) {
108
+ var common = from && to ? getLowestCommonAncestor(from, to) : null;
109
+ var pathFrom = [];
110
+ while (from && from !== common) {
111
+ pathFrom.push(from);
112
+ from = from._nativeParent;
113
+ }
114
+ var pathTo = [];
115
+ while (to && to !== common) {
116
+ pathTo.push(to);
117
+ to = to._nativeParent;
118
+ }
119
+ var i;
120
+ for (i = 0; i < pathFrom.length; i++) {
121
+ fn(pathFrom[i], true, argFrom);
122
+ }
123
+ for (i = pathTo.length; i-- > 0;) {
124
+ fn(pathTo[i], false, argTo);
125
+ }
126
+ }
127
+
128
+ module.exports = {
129
+ isAncestor: isAncestor,
130
+ getLowestCommonAncestor: getLowestCommonAncestor,
131
+ getParentInstance: getParentInstance,
132
+ traverseTwoPhase: traverseTwoPhase,
133
+ traverseEnterLeave: traverseEnterLeave
134
+ };