react 15.3.2-rc.1 → 15.4.0-rc.3

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 (209) hide show
  1. package/dist/react-with-addons.js +3863 -21388
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/sliceChildren.js +0 -1
  52. package/lib/traverseAllChildren.js +11 -3
  53. package/lib/update.js +6 -8
  54. package/package.json +1 -1
  55. package/lib/AutoFocusUtils.js +0 -24
  56. package/lib/BeforeInputEventPlugin.js +0 -390
  57. package/lib/CSSProperty.js +0 -148
  58. package/lib/CSSPropertyOperations.js +0 -205
  59. package/lib/CallbackQueue.js +0 -106
  60. package/lib/ChangeEventPlugin.js +0 -325
  61. package/lib/DOMChildrenOperations.js +0 -194
  62. package/lib/DOMLazyTree.js +0 -118
  63. package/lib/DOMProperty.js +0 -206
  64. package/lib/DOMPropertyOperations.js +0 -221
  65. package/lib/Danger.js +0 -48
  66. package/lib/DefaultEventPluginOrder.js +0 -27
  67. package/lib/DisabledInputUtils.js +0 -50
  68. package/lib/EnterLeaveEventPlugin.js +0 -105
  69. package/lib/EventConstants.js +0 -97
  70. package/lib/EventPluginHub.js +0 -251
  71. package/lib/EventPluginRegistry.js +0 -247
  72. package/lib/EventPluginUtils.js +0 -229
  73. package/lib/EventPropagators.js +0 -137
  74. package/lib/FallbackCompositionState.js +0 -95
  75. package/lib/HTMLDOMPropertyConfig.js +0 -212
  76. package/lib/LinkedValueUtils.js +0 -136
  77. package/lib/NativeMethodsMixin.js +0 -167
  78. package/lib/ReactBrowserEventEmitter.js +0 -330
  79. package/lib/ReactChildReconciler.js +0 -154
  80. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  81. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  82. package/lib/ReactComponentEnvironment.js +0 -45
  83. package/lib/ReactComponentTreeTestUtils.js +0 -87
  84. package/lib/ReactCompositeComponent.js +0 -904
  85. package/lib/ReactDOM.js +0 -110
  86. package/lib/ReactDOMButton.js +0 -24
  87. package/lib/ReactDOMComponent.js +0 -1006
  88. package/lib/ReactDOMComponentTree.js +0 -188
  89. package/lib/ReactDOMContainerInfo.js +0 -33
  90. package/lib/ReactDOMEmptyComponent.js +0 -60
  91. package/lib/ReactDOMFiber.js +0 -76
  92. package/lib/ReactDOMIDOperations.js +0 -34
  93. package/lib/ReactDOMInput.js +0 -269
  94. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  95. package/lib/ReactDOMOption.js +0 -123
  96. package/lib/ReactDOMSelect.js +0 -201
  97. package/lib/ReactDOMSelection.js +0 -212
  98. package/lib/ReactDOMServer.js +0 -26
  99. package/lib/ReactDOMTextComponent.js +0 -164
  100. package/lib/ReactDOMTextarea.js +0 -155
  101. package/lib/ReactDOMTreeTraversal.js +0 -136
  102. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  103. package/lib/ReactDebugTool.js +0 -301
  104. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  105. package/lib/ReactDefaultInjection.js +0 -84
  106. package/lib/ReactEmptyComponent.js +0 -30
  107. package/lib/ReactErrorUtils.js +0 -76
  108. package/lib/ReactEventEmitterMixin.js +0 -33
  109. package/lib/ReactEventListener.js +0 -157
  110. package/lib/ReactFeatureFlags.js +0 -22
  111. package/lib/ReactHostComponent.js +0 -76
  112. package/lib/ReactHostOperationHistoryHook.js +0 -37
  113. package/lib/ReactInjection.js +0 -36
  114. package/lib/ReactInputSelection.js +0 -124
  115. package/lib/ReactInstanceHandles.js +0 -302
  116. package/lib/ReactInstanceMap.js +0 -48
  117. package/lib/ReactInstrumentation.js +0 -21
  118. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  119. package/lib/ReactMarkupChecksum.js +0 -50
  120. package/lib/ReactMount.js +0 -534
  121. package/lib/ReactMultiChild.js +0 -451
  122. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  123. package/lib/ReactNative.js +0 -71
  124. package/lib/ReactNativeAttributePayload.js +0 -371
  125. package/lib/ReactNativeBaseComponent.js +0 -198
  126. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  127. package/lib/ReactNativeComponentEnvironment.js +0 -31
  128. package/lib/ReactNativeComponentTree.js +0 -68
  129. package/lib/ReactNativeContainerInfo.js +0 -21
  130. package/lib/ReactNativeDOMIDOperations.js +0 -79
  131. package/lib/ReactNativeDefaultInjection.js +0 -101
  132. package/lib/ReactNativeEventEmitter.js +0 -191
  133. package/lib/ReactNativeEventPluginOrder.js +0 -16
  134. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  135. package/lib/ReactNativeMount.js +0 -193
  136. package/lib/ReactNativePropRegistry.js +0 -52
  137. package/lib/ReactNativeReconcileTransaction.js +0 -129
  138. package/lib/ReactNativeTagHandles.js +0 -56
  139. package/lib/ReactNativeTextComponent.js +0 -71
  140. package/lib/ReactNativeTreeTraversal.js +0 -127
  141. package/lib/ReactNodeTypes.js +0 -40
  142. package/lib/ReactNoop.js +0 -173
  143. package/lib/ReactOwner.js +0 -94
  144. package/lib/ReactPerf.js +0 -494
  145. package/lib/ReactReconcileTransaction.js +0 -178
  146. package/lib/ReactReconciler.js +0 -168
  147. package/lib/ReactRef.js +0 -80
  148. package/lib/ReactServerBatchingStrategy.js +0 -22
  149. package/lib/ReactServerRendering.js +0 -90
  150. package/lib/ReactServerRenderingTransaction.js +0 -90
  151. package/lib/ReactServerUpdateQueue.js +0 -141
  152. package/lib/ReactSimpleEmptyComponent.js +0 -37
  153. package/lib/ReactTestMount.js +0 -126
  154. package/lib/ReactTestReconcileTransaction.js +0 -121
  155. package/lib/ReactTestRenderer.js +0 -144
  156. package/lib/ReactTestUtils.js +0 -518
  157. package/lib/ReactUpdateQueue.js +0 -226
  158. package/lib/ReactUpdates.js +0 -251
  159. package/lib/ResponderEventPlugin.js +0 -510
  160. package/lib/ResponderSyntheticEvent.js +0 -39
  161. package/lib/ResponderTouchHistoryStore.js +0 -184
  162. package/lib/SVGDOMPropertyConfig.js +0 -302
  163. package/lib/SelectEventPlugin.js +0 -196
  164. package/lib/SimpleEventPlugin.js +0 -635
  165. package/lib/SyntheticAnimationEvent.js +0 -39
  166. package/lib/SyntheticClipboardEvent.js +0 -38
  167. package/lib/SyntheticCompositionEvent.js +0 -36
  168. package/lib/SyntheticDragEvent.js +0 -36
  169. package/lib/SyntheticEvent.js +0 -268
  170. package/lib/SyntheticFocusEvent.js +0 -36
  171. package/lib/SyntheticInputEvent.js +0 -37
  172. package/lib/SyntheticKeyboardEvent.js +0 -84
  173. package/lib/SyntheticMouseEvent.js +0 -72
  174. package/lib/SyntheticTouchEvent.js +0 -45
  175. package/lib/SyntheticTransitionEvent.js +0 -39
  176. package/lib/SyntheticUIEvent.js +0 -59
  177. package/lib/SyntheticWheelEvent.js +0 -54
  178. package/lib/TapEventPlugin.js +0 -110
  179. package/lib/TouchHistoryMath.js +0 -99
  180. package/lib/Transaction.js +0 -233
  181. package/lib/ViewportMetrics.js +0 -27
  182. package/lib/accumulate.js +0 -46
  183. package/lib/accumulateInto.js +0 -58
  184. package/lib/adler32.js +0 -44
  185. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  186. package/lib/createReactNativeComponentClass.js +0 -42
  187. package/lib/dangerousStyleValue.js +0 -79
  188. package/lib/escapeTextContentForBrowser.js +0 -123
  189. package/lib/findDOMNode.js +0 -60
  190. package/lib/findNodeHandle.js +0 -91
  191. package/lib/forEachAccumulated.js +0 -31
  192. package/lib/getEventCharCode.js +0 -50
  193. package/lib/getEventKey.js +0 -102
  194. package/lib/getEventModifierState.js +0 -43
  195. package/lib/getEventTarget.js +0 -35
  196. package/lib/getHostComponentFromComposite.js +0 -30
  197. package/lib/getNodeForCharacterOffset.js +0 -74
  198. package/lib/getTestDocument.js +0 -21
  199. package/lib/getTextContentAccessor.js +0 -33
  200. package/lib/getVendorPrefixedEventName.js +0 -101
  201. package/lib/instantiateReactComponent.js +0 -119
  202. package/lib/isEventSupported.js +0 -60
  203. package/lib/isTextInputElement.js +0 -51
  204. package/lib/quoteAttributeValueForBrowser.js +0 -26
  205. package/lib/reactComponentExpect.js +0 -217
  206. package/lib/setInnerHTML.js +0 -98
  207. package/lib/setTextContent.js +0 -48
  208. package/lib/shouldUpdateReactComponent.js +0 -42
  209. package/lib/validateDOMNesting.js +0 -382
@@ -1,26 +0,0 @@
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 ReactDOMServer
10
- */
11
-
12
- 'use strict';
13
-
14
- var ReactDefaultInjection = require('./ReactDefaultInjection');
15
- var ReactServerRendering = require('./ReactServerRendering');
16
- var ReactVersion = require('./ReactVersion');
17
-
18
- ReactDefaultInjection.inject();
19
-
20
- var ReactDOMServer = {
21
- renderToString: ReactServerRendering.renderToString,
22
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
23
- version: ReactVersion
24
- };
25
-
26
- module.exports = ReactDOMServer;
@@ -1,164 +0,0 @@
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 ReactDOMTextComponent
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant'),
15
- _assign = require('object-assign');
16
-
17
- var DOMChildrenOperations = require('./DOMChildrenOperations');
18
- var DOMLazyTree = require('./DOMLazyTree');
19
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
20
-
21
- var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
22
- var invariant = require('fbjs/lib/invariant');
23
- var validateDOMNesting = require('./validateDOMNesting');
24
-
25
- /**
26
- * Text nodes violate a couple assumptions that React makes about components:
27
- *
28
- * - When mounting text into the DOM, adjacent text nodes are merged.
29
- * - Text nodes cannot be assigned a React root ID.
30
- *
31
- * This component is used to wrap strings between comment nodes so that they
32
- * can undergo the same reconciliation that is applied to elements.
33
- *
34
- * TODO: Investigate representing React components in the DOM with text nodes.
35
- *
36
- * @class ReactDOMTextComponent
37
- * @extends ReactComponent
38
- * @internal
39
- */
40
- var ReactDOMTextComponent = function (text) {
41
- // TODO: This is really a ReactText (ReactNode), not a ReactElement
42
- this._currentElement = text;
43
- this._stringText = '' + text;
44
- // ReactDOMComponentTree uses these:
45
- this._hostNode = null;
46
- this._hostParent = null;
47
-
48
- // Properties
49
- this._domID = 0;
50
- this._mountIndex = 0;
51
- this._closingComment = null;
52
- this._commentNodes = null;
53
- };
54
-
55
- _assign(ReactDOMTextComponent.prototype, {
56
-
57
- /**
58
- * Creates the markup for this text node. This node is not intended to have
59
- * any features besides containing text content.
60
- *
61
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
62
- * @return {string} Markup for this text node.
63
- * @internal
64
- */
65
- mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
66
- if (process.env.NODE_ENV !== 'production') {
67
- var parentInfo;
68
- if (hostParent != null) {
69
- parentInfo = hostParent._ancestorInfo;
70
- } else if (hostContainerInfo != null) {
71
- parentInfo = hostContainerInfo._ancestorInfo;
72
- }
73
- if (parentInfo) {
74
- // parentInfo should always be present except for the top-level
75
- // component when server rendering
76
- validateDOMNesting(null, this._stringText, this, parentInfo);
77
- }
78
- }
79
-
80
- var domID = hostContainerInfo._idCounter++;
81
- var openingValue = ' react-text: ' + domID + ' ';
82
- var closingValue = ' /react-text ';
83
- this._domID = domID;
84
- this._hostParent = hostParent;
85
- if (transaction.useCreateElement) {
86
- var ownerDocument = hostContainerInfo._ownerDocument;
87
- var openingComment = ownerDocument.createComment(openingValue);
88
- var closingComment = ownerDocument.createComment(closingValue);
89
- var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
90
- DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
91
- if (this._stringText) {
92
- DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
93
- }
94
- DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
95
- ReactDOMComponentTree.precacheNode(this, openingComment);
96
- this._closingComment = closingComment;
97
- return lazyTree;
98
- } else {
99
- var escapedText = escapeTextContentForBrowser(this._stringText);
100
-
101
- if (transaction.renderToStaticMarkup) {
102
- // Normally we'd wrap this between comment nodes for the reasons stated
103
- // above, but since this is a situation where React won't take over
104
- // (static pages), we can simply return the text as it is.
105
- return escapedText;
106
- }
107
-
108
- return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
109
- }
110
- },
111
-
112
- /**
113
- * Updates this component by updating the text content.
114
- *
115
- * @param {ReactText} nextText The next text content
116
- * @param {ReactReconcileTransaction} transaction
117
- * @internal
118
- */
119
- receiveComponent: function (nextText, transaction) {
120
- if (nextText !== this._currentElement) {
121
- this._currentElement = nextText;
122
- var nextStringText = '' + nextText;
123
- if (nextStringText !== this._stringText) {
124
- // TODO: Save this as pending props and use performUpdateIfNecessary
125
- // and/or updateComponent to do the actual update for consistency with
126
- // other component types?
127
- this._stringText = nextStringText;
128
- var commentNodes = this.getHostNode();
129
- DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
130
- }
131
- }
132
- },
133
-
134
- getHostNode: function () {
135
- var hostNode = this._commentNodes;
136
- if (hostNode) {
137
- return hostNode;
138
- }
139
- if (!this._closingComment) {
140
- var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
141
- var node = openingComment.nextSibling;
142
- while (true) {
143
- !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
144
- if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
145
- this._closingComment = node;
146
- break;
147
- }
148
- node = node.nextSibling;
149
- }
150
- }
151
- hostNode = [this._hostNode, this._closingComment];
152
- this._commentNodes = hostNode;
153
- return hostNode;
154
- },
155
-
156
- unmountComponent: function () {
157
- this._closingComment = null;
158
- this._commentNodes = null;
159
- ReactDOMComponentTree.uncacheNode(this);
160
- }
161
-
162
- });
163
-
164
- module.exports = ReactDOMTextComponent;
@@ -1,155 +0,0 @@
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 ReactDOMTextarea
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant'),
15
- _assign = require('object-assign');
16
-
17
- var DisabledInputUtils = require('./DisabledInputUtils');
18
- var LinkedValueUtils = require('./LinkedValueUtils');
19
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
20
- var ReactUpdates = require('./ReactUpdates');
21
-
22
- var invariant = require('fbjs/lib/invariant');
23
- var warning = require('fbjs/lib/warning');
24
-
25
- var didWarnValueLink = false;
26
- var didWarnValDefaultVal = false;
27
-
28
- function forceUpdateIfMounted() {
29
- if (this._rootNodeID) {
30
- // DOM component is still mounted; update
31
- ReactDOMTextarea.updateWrapper(this);
32
- }
33
- }
34
-
35
- /**
36
- * Implements a <textarea> host component that allows setting `value`, and
37
- * `defaultValue`. This differs from the traditional DOM API because value is
38
- * usually set as PCDATA children.
39
- *
40
- * If `value` is not supplied (or null/undefined), user actions that affect the
41
- * value will trigger updates to the element.
42
- *
43
- * If `value` is supplied (and not null/undefined), the rendered element will
44
- * not trigger updates to the element. Instead, the `value` prop must change in
45
- * order for the rendered element to be updated.
46
- *
47
- * The rendered element will be initialized with an empty value, the prop
48
- * `defaultValue` if specified, or the children content (deprecated).
49
- */
50
- var ReactDOMTextarea = {
51
- getHostProps: function (inst, props) {
52
- !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
53
-
54
- // Always set children to the same thing. In IE9, the selection range will
55
- // get reset if `textContent` is mutated. We could add a check in setTextContent
56
- // to only set the value if/when the value differs from the node value (which would
57
- // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
58
- // The value can be a boolean or object so that's why it's forced to be a string.
59
- var hostProps = _assign({}, DisabledInputUtils.getHostProps(inst, props), {
60
- value: undefined,
61
- defaultValue: undefined,
62
- children: '' + inst._wrapperState.initialValue,
63
- onChange: inst._wrapperState.onChange
64
- });
65
-
66
- return hostProps;
67
- },
68
-
69
- mountWrapper: function (inst, props) {
70
- if (process.env.NODE_ENV !== 'production') {
71
- LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
72
- if (props.valueLink !== undefined && !didWarnValueLink) {
73
- process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
74
- didWarnValueLink = true;
75
- }
76
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
77
- 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;
78
- didWarnValDefaultVal = true;
79
- }
80
- }
81
-
82
- var value = LinkedValueUtils.getValue(props);
83
- var initialValue = value;
84
-
85
- // Only bother fetching default value if we're going to use it
86
- if (value == null) {
87
- var defaultValue = props.defaultValue;
88
- // TODO (yungsters): Remove support for children content in <textarea>.
89
- var children = props.children;
90
- if (children != null) {
91
- if (process.env.NODE_ENV !== 'production') {
92
- process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
93
- }
94
- !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
95
- if (Array.isArray(children)) {
96
- !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
97
- children = children[0];
98
- }
99
-
100
- defaultValue = '' + children;
101
- }
102
- if (defaultValue == null) {
103
- defaultValue = '';
104
- }
105
- initialValue = defaultValue;
106
- }
107
-
108
- inst._wrapperState = {
109
- initialValue: '' + initialValue,
110
- listeners: null,
111
- onChange: _handleChange.bind(inst)
112
- };
113
- },
114
-
115
- updateWrapper: function (inst) {
116
- var props = inst._currentElement.props;
117
-
118
- var node = ReactDOMComponentTree.getNodeFromInstance(inst);
119
- var value = LinkedValueUtils.getValue(props);
120
- if (value != null) {
121
- // Cast `value` to a string to ensure the value is set correctly. While
122
- // browsers typically do this as necessary, jsdom doesn't.
123
- var newValue = '' + value;
124
-
125
- // To avoid side effects (such as losing text selection), only set value if changed
126
- if (newValue !== node.value) {
127
- node.value = newValue;
128
- }
129
- if (props.defaultValue == null) {
130
- node.defaultValue = newValue;
131
- }
132
- }
133
- if (props.defaultValue != null) {
134
- node.defaultValue = props.defaultValue;
135
- }
136
- },
137
-
138
- postMountWrapper: function (inst) {
139
- // This is in postMount because we need access to the DOM node, which is not
140
- // available until after the component has mounted.
141
- var node = ReactDOMComponentTree.getNodeFromInstance(inst);
142
-
143
- // Warning: node.value may be the empty string at this point (IE11) if placeholder is set.
144
- node.value = node.textContent; // Detach value from defaultValue
145
- }
146
- };
147
-
148
- function _handleChange(event) {
149
- var props = this._currentElement.props;
150
- var returnValue = LinkedValueUtils.executeOnChange(props, event);
151
- ReactUpdates.asap(forceUpdateIfMounted, this);
152
- return returnValue;
153
- }
154
-
155
- module.exports = ReactDOMTextarea;
@@ -1,136 +0,0 @@
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 _prodInvariant = require('./reactProdInvariant');
15
-
16
- var invariant = require('fbjs/lib/invariant');
17
-
18
- /**
19
- * Return the lowest common ancestor of A and B, or null if they are in
20
- * different trees.
21
- */
22
- function getLowestCommonAncestor(instA, instB) {
23
- !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
24
- !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
25
-
26
- var depthA = 0;
27
- for (var tempA = instA; tempA; tempA = tempA._hostParent) {
28
- depthA++;
29
- }
30
- var depthB = 0;
31
- for (var tempB = instB; tempB; tempB = tempB._hostParent) {
32
- depthB++;
33
- }
34
-
35
- // If A is deeper, crawl up.
36
- while (depthA - depthB > 0) {
37
- instA = instA._hostParent;
38
- depthA--;
39
- }
40
-
41
- // If B is deeper, crawl up.
42
- while (depthB - depthA > 0) {
43
- instB = instB._hostParent;
44
- depthB--;
45
- }
46
-
47
- // Walk in lockstep until we find a match.
48
- var depth = depthA;
49
- while (depth--) {
50
- if (instA === instB) {
51
- return instA;
52
- }
53
- instA = instA._hostParent;
54
- instB = instB._hostParent;
55
- }
56
- return null;
57
- }
58
-
59
- /**
60
- * Return if A is an ancestor of B.
61
- */
62
- function isAncestor(instA, instB) {
63
- !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
64
- !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
65
-
66
- while (instB) {
67
- if (instB === instA) {
68
- return true;
69
- }
70
- instB = instB._hostParent;
71
- }
72
- return false;
73
- }
74
-
75
- /**
76
- * Return the parent instance of the passed-in instance.
77
- */
78
- function getParentInstance(inst) {
79
- !('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
80
-
81
- return inst._hostParent;
82
- }
83
-
84
- /**
85
- * Simulates the traversal of a two-phase, capture/bubble event dispatch.
86
- */
87
- function traverseTwoPhase(inst, fn, arg) {
88
- var path = [];
89
- while (inst) {
90
- path.push(inst);
91
- inst = inst._hostParent;
92
- }
93
- var i;
94
- for (i = path.length; i-- > 0;) {
95
- fn(path[i], false, arg);
96
- }
97
- for (i = 0; i < path.length; i++) {
98
- fn(path[i], true, arg);
99
- }
100
- }
101
-
102
- /**
103
- * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
104
- * should would receive a `mouseEnter` or `mouseLeave` event.
105
- *
106
- * Does not invoke the callback on the nearest common ancestor because nothing
107
- * "entered" or "left" that element.
108
- */
109
- function traverseEnterLeave(from, to, fn, argFrom, argTo) {
110
- var common = from && to ? getLowestCommonAncestor(from, to) : null;
111
- var pathFrom = [];
112
- while (from && from !== common) {
113
- pathFrom.push(from);
114
- from = from._hostParent;
115
- }
116
- var pathTo = [];
117
- while (to && to !== common) {
118
- pathTo.push(to);
119
- to = to._hostParent;
120
- }
121
- var i;
122
- for (i = 0; i < pathFrom.length; i++) {
123
- fn(pathFrom[i], true, argFrom);
124
- }
125
- for (i = pathTo.length; i-- > 0;) {
126
- fn(pathTo[i], false, argTo);
127
- }
128
- }
129
-
130
- module.exports = {
131
- isAncestor: isAncestor,
132
- getLowestCommonAncestor: getLowestCommonAncestor,
133
- getParentInstance: getParentInstance,
134
- traverseTwoPhase: traverseTwoPhase,
135
- traverseEnterLeave: traverseEnterLeave
136
- };