react 15.3.1-rc.2 → 15.4.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 (190) hide show
  1. package/dist/react-with-addons.js +3961 -21387
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2701 -19464
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -29
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +30 -13
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/onlyChild.js +1 -1
  33. package/lib/traverseAllChildren.js +11 -2
  34. package/lib/update.js +6 -7
  35. package/package.json +2 -2
  36. package/lib/AutoFocusUtils.js +0 -24
  37. package/lib/BeforeInputEventPlugin.js +0 -388
  38. package/lib/CSSProperty.js +0 -148
  39. package/lib/CSSPropertyOperations.js +0 -205
  40. package/lib/CallbackQueue.js +0 -106
  41. package/lib/ChangeEventPlugin.js +0 -325
  42. package/lib/DOMChildrenOperations.js +0 -194
  43. package/lib/DOMLazyTree.js +0 -118
  44. package/lib/DOMProperty.js +0 -206
  45. package/lib/DOMPropertyOperations.js +0 -221
  46. package/lib/Danger.js +0 -48
  47. package/lib/DefaultEventPluginOrder.js +0 -27
  48. package/lib/DisabledInputUtils.js +0 -50
  49. package/lib/EnterLeaveEventPlugin.js +0 -105
  50. package/lib/EventConstants.js +0 -97
  51. package/lib/EventPluginHub.js +0 -251
  52. package/lib/EventPluginRegistry.js +0 -247
  53. package/lib/EventPluginUtils.js +0 -229
  54. package/lib/EventPropagators.js +0 -137
  55. package/lib/FallbackCompositionState.js +0 -95
  56. package/lib/HTMLDOMPropertyConfig.js +0 -209
  57. package/lib/LinkedValueUtils.js +0 -136
  58. package/lib/NativeMethodsMixin.js +0 -167
  59. package/lib/ReactBrowserEventEmitter.js +0 -317
  60. package/lib/ReactChildReconciler.js +0 -154
  61. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  62. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  63. package/lib/ReactComponentEnvironment.js +0 -45
  64. package/lib/ReactComponentTreeTestUtils.js +0 -87
  65. package/lib/ReactCompositeComponent.js +0 -920
  66. package/lib/ReactDOM.js +0 -110
  67. package/lib/ReactDOMButton.js +0 -24
  68. package/lib/ReactDOMComponent.js +0 -1005
  69. package/lib/ReactDOMComponentTree.js +0 -188
  70. package/lib/ReactDOMContainerInfo.js +0 -33
  71. package/lib/ReactDOMEmptyComponent.js +0 -60
  72. package/lib/ReactDOMFiber.js +0 -78
  73. package/lib/ReactDOMIDOperations.js +0 -34
  74. package/lib/ReactDOMInput.js +0 -269
  75. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  76. package/lib/ReactDOMOption.js +0 -123
  77. package/lib/ReactDOMSelect.js +0 -201
  78. package/lib/ReactDOMSelection.js +0 -212
  79. package/lib/ReactDOMServer.js +0 -26
  80. package/lib/ReactDOMTextComponent.js +0 -164
  81. package/lib/ReactDOMTextarea.js +0 -155
  82. package/lib/ReactDOMTreeTraversal.js +0 -136
  83. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  84. package/lib/ReactDebugTool.js +0 -307
  85. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  86. package/lib/ReactDefaultInjection.js +0 -84
  87. package/lib/ReactEmptyComponent.js +0 -30
  88. package/lib/ReactErrorUtils.js +0 -76
  89. package/lib/ReactEventEmitterMixin.js +0 -33
  90. package/lib/ReactEventListener.js +0 -157
  91. package/lib/ReactFeatureFlags.js +0 -22
  92. package/lib/ReactHostComponent.js +0 -76
  93. package/lib/ReactHostOperationHistoryHook.js +0 -37
  94. package/lib/ReactInjection.js +0 -36
  95. package/lib/ReactInputSelection.js +0 -124
  96. package/lib/ReactInstanceHandles.js +0 -302
  97. package/lib/ReactInstanceMap.js +0 -48
  98. package/lib/ReactInstrumentation.js +0 -21
  99. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  100. package/lib/ReactMarkupChecksum.js +0 -50
  101. package/lib/ReactMount.js +0 -495
  102. package/lib/ReactMultiChild.js +0 -451
  103. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  104. package/lib/ReactNative.js +0 -71
  105. package/lib/ReactNativeAttributePayload.js +0 -371
  106. package/lib/ReactNativeBaseComponent.js +0 -198
  107. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  108. package/lib/ReactNativeComponentEnvironment.js +0 -31
  109. package/lib/ReactNativeComponentTree.js +0 -68
  110. package/lib/ReactNativeContainerInfo.js +0 -21
  111. package/lib/ReactNativeDOMIDOperations.js +0 -79
  112. package/lib/ReactNativeDefaultInjection.js +0 -101
  113. package/lib/ReactNativeEventEmitter.js +0 -191
  114. package/lib/ReactNativeEventPluginOrder.js +0 -16
  115. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  116. package/lib/ReactNativeMount.js +0 -193
  117. package/lib/ReactNativePropRegistry.js +0 -52
  118. package/lib/ReactNativeReconcileTransaction.js +0 -116
  119. package/lib/ReactNativeTagHandles.js +0 -56
  120. package/lib/ReactNativeTextComponent.js +0 -71
  121. package/lib/ReactNativeTreeTraversal.js +0 -127
  122. package/lib/ReactNodeTypes.js +0 -40
  123. package/lib/ReactNoop.js +0 -173
  124. package/lib/ReactOwner.js +0 -94
  125. package/lib/ReactPerf.js +0 -494
  126. package/lib/ReactReconcileTransaction.js +0 -178
  127. package/lib/ReactReconciler.js +0 -168
  128. package/lib/ReactRef.js +0 -80
  129. package/lib/ReactServerBatchingStrategy.js +0 -22
  130. package/lib/ReactServerRendering.js +0 -90
  131. package/lib/ReactServerRenderingTransaction.js +0 -90
  132. package/lib/ReactServerUpdateQueue.js +0 -141
  133. package/lib/ReactSimpleEmptyComponent.js +0 -37
  134. package/lib/ReactTestMount.js +0 -123
  135. package/lib/ReactTestReconcileTransaction.js +0 -108
  136. package/lib/ReactTestRenderer.js +0 -144
  137. package/lib/ReactTestUtils.js +0 -518
  138. package/lib/ReactUpdateQueue.js +0 -226
  139. package/lib/ReactUpdates.js +0 -251
  140. package/lib/ResponderEventPlugin.js +0 -510
  141. package/lib/ResponderSyntheticEvent.js +0 -39
  142. package/lib/ResponderTouchHistoryStore.js +0 -184
  143. package/lib/SVGDOMPropertyConfig.js +0 -302
  144. package/lib/SelectEventPlugin.js +0 -196
  145. package/lib/SimpleEventPlugin.js +0 -635
  146. package/lib/SyntheticAnimationEvent.js +0 -39
  147. package/lib/SyntheticClipboardEvent.js +0 -38
  148. package/lib/SyntheticCompositionEvent.js +0 -36
  149. package/lib/SyntheticDragEvent.js +0 -36
  150. package/lib/SyntheticEvent.js +0 -267
  151. package/lib/SyntheticFocusEvent.js +0 -36
  152. package/lib/SyntheticInputEvent.js +0 -37
  153. package/lib/SyntheticKeyboardEvent.js +0 -84
  154. package/lib/SyntheticMouseEvent.js +0 -72
  155. package/lib/SyntheticTouchEvent.js +0 -45
  156. package/lib/SyntheticTransitionEvent.js +0 -39
  157. package/lib/SyntheticUIEvent.js +0 -59
  158. package/lib/SyntheticWheelEvent.js +0 -54
  159. package/lib/TapEventPlugin.js +0 -110
  160. package/lib/TouchHistoryMath.js +0 -99
  161. package/lib/Transaction.js +0 -233
  162. package/lib/ViewportMetrics.js +0 -27
  163. package/lib/accumulate.js +0 -46
  164. package/lib/accumulateInto.js +0 -58
  165. package/lib/adler32.js +0 -44
  166. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  167. package/lib/createReactNativeComponentClass.js +0 -42
  168. package/lib/dangerousStyleValue.js +0 -79
  169. package/lib/escapeTextContentForBrowser.js +0 -122
  170. package/lib/findDOMNode.js +0 -60
  171. package/lib/findNodeHandle.js +0 -91
  172. package/lib/forEachAccumulated.js +0 -31
  173. package/lib/getEventCharCode.js +0 -50
  174. package/lib/getEventKey.js +0 -102
  175. package/lib/getEventModifierState.js +0 -43
  176. package/lib/getEventTarget.js +0 -35
  177. package/lib/getHostComponentFromComposite.js +0 -30
  178. package/lib/getNodeForCharacterOffset.js +0 -74
  179. package/lib/getTestDocument.js +0 -21
  180. package/lib/getTextContentAccessor.js +0 -33
  181. package/lib/getVendorPrefixedEventName.js +0 -101
  182. package/lib/instantiateReactComponent.js +0 -119
  183. package/lib/isEventSupported.js +0 -60
  184. package/lib/isTextInputElement.js +0 -51
  185. package/lib/quoteAttributeValueForBrowser.js +0 -26
  186. package/lib/reactComponentExpect.js +0 -217
  187. package/lib/setInnerHTML.js +0 -98
  188. package/lib/setTextContent.js +0 -48
  189. package/lib/shouldUpdateReactComponent.js +0 -42
  190. package/lib/validateDOMNesting.js +0 -369
@@ -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('#text', 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
- };