react 0.13.3 → 0.14.0-beta1

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 (189) hide show
  1. package/README.md +5 -2
  2. package/addons.js +7 -0
  3. package/dist/JSXTransformer.js +4101 -2432
  4. package/dist/react-with-addons.js +4389 -6277
  5. package/dist/react-with-addons.min.js +6 -8
  6. package/dist/react.js +4028 -5697
  7. package/dist/react.min.js +5 -6
  8. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +16 -5
  9. package/lib/BeforeInputEventPlugin.js +30 -118
  10. package/lib/CSSCore.js +12 -23
  11. package/lib/CSSProperty.js +4 -3
  12. package/lib/CSSPropertyOperations.js +14 -30
  13. package/lib/CallbackQueue.js +7 -10
  14. package/lib/ChangeEventPlugin.js +26 -88
  15. package/lib/ClientReactRootIndex.js +2 -2
  16. package/lib/DOMChildrenOperations.js +13 -33
  17. package/lib/DOMProperty.js +86 -147
  18. package/lib/DOMPropertyOperations.js +91 -67
  19. package/lib/Danger.js +19 -62
  20. package/lib/DefaultEventPluginOrder.js +2 -12
  21. package/lib/EnterLeaveEventPlugin.js +11 -33
  22. package/lib/EventConstants.js +2 -2
  23. package/lib/EventListener.js +11 -13
  24. package/lib/EventPluginHub.js +44 -47
  25. package/lib/EventPluginRegistry.js +18 -74
  26. package/lib/EventPluginUtils.js +33 -44
  27. package/lib/EventPropagators.js +23 -26
  28. package/lib/ExecutionEnvironment.js +4 -8
  29. package/lib/FallbackCompositionState.js +3 -3
  30. package/lib/HTMLDOMPropertyConfig.js +15 -20
  31. package/lib/LinkedStateMixin.js +3 -6
  32. package/lib/LinkedValueUtils.js +71 -89
  33. package/lib/Object.assign.js +1 -1
  34. package/lib/PooledClass.js +20 -11
  35. package/lib/React.js +9 -129
  36. package/lib/ReactBrowserComponentMixin.js +9 -2
  37. package/lib/ReactBrowserEventEmitter.js +26 -82
  38. package/lib/ReactCSSTransitionGroup.js +13 -24
  39. package/lib/ReactCSSTransitionGroupChild.js +26 -28
  40. package/lib/ReactChildReconciler.js +11 -19
  41. package/lib/ReactChildren.js +24 -31
  42. package/lib/ReactClass.js +96 -267
  43. package/lib/ReactComponent.js +28 -57
  44. package/lib/ReactComponentBrowserEnvironment.js +4 -8
  45. package/lib/ReactComponentEnvironment.js +6 -12
  46. package/lib/ReactComponentWithPureRenderMixin.js +6 -7
  47. package/lib/ReactCompositeComponent.js +115 -381
  48. package/lib/ReactCurrentOwner.js +1 -3
  49. package/lib/ReactDOM.js +4 -2
  50. package/lib/ReactDOMButton.js +16 -28
  51. package/lib/ReactDOMClient.js +90 -0
  52. package/lib/ReactDOMComponent.js +468 -156
  53. package/lib/ReactDOMIDOperations.js +25 -22
  54. package/lib/ReactDOMInput.js +79 -108
  55. package/lib/ReactDOMOption.js +58 -20
  56. package/lib/ReactDOMSelect.js +95 -83
  57. package/lib/ReactDOMSelection.js +5 -20
  58. package/lib/ReactDOMServer.js +24 -0
  59. package/lib/ReactDOMTextComponent.js +17 -18
  60. package/lib/ReactDOMTextarea.js +44 -69
  61. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  62. package/lib/ReactDefaultInjection.js +20 -76
  63. package/lib/ReactDefaultPerf.js +36 -69
  64. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  65. package/lib/ReactElement.js +26 -120
  66. package/lib/ReactElementValidator.js +56 -192
  67. package/lib/ReactEmptyComponent.js +7 -11
  68. package/lib/ReactErrorUtils.js +3 -3
  69. package/lib/ReactEventEmitterMixin.js +3 -13
  70. package/lib/ReactEventListener.js +58 -40
  71. package/lib/ReactFragment.js +33 -59
  72. package/lib/ReactInjection.js +1 -1
  73. package/lib/ReactInputSelection.js +14 -23
  74. package/lib/ReactInstanceHandles.js +29 -58
  75. package/lib/ReactInstanceMap.js +5 -5
  76. package/lib/ReactIsomorphic.js +70 -0
  77. package/lib/ReactLink.js +2 -4
  78. package/lib/ReactMarkupChecksum.js +5 -10
  79. package/lib/ReactMount.js +142 -285
  80. package/lib/ReactMultiChild.js +19 -45
  81. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  82. package/lib/ReactNativeComponent.js +6 -15
  83. package/lib/ReactNoopUpdateQueue.js +118 -0
  84. package/lib/ReactOwner.js +7 -24
  85. package/lib/ReactPerf.js +8 -12
  86. package/lib/ReactPropTransferer.js +4 -4
  87. package/lib/ReactPropTypeLocationNames.js +2 -2
  88. package/lib/ReactPropTypeLocations.js +1 -1
  89. package/lib/ReactPropTypes.js +41 -61
  90. package/lib/ReactReconcileTransaction.js +11 -36
  91. package/lib/ReactReconciler.js +14 -26
  92. package/lib/ReactRef.js +5 -8
  93. package/lib/ReactRootIndex.js +2 -2
  94. package/lib/ReactServerBatchingStrategy.js +23 -0
  95. package/lib/ReactServerRendering.js +20 -15
  96. package/lib/ReactServerRenderingTransaction.js +9 -34
  97. package/lib/ReactStateSetters.js +6 -6
  98. package/lib/ReactTestUtils.js +137 -190
  99. package/lib/ReactTransitionChildMapping.js +5 -7
  100. package/lib/ReactTransitionEvents.js +5 -5
  101. package/lib/ReactTransitionGroup.js +30 -52
  102. package/lib/ReactUpdateQueue.js +69 -107
  103. package/lib/ReactUpdates.js +26 -81
  104. package/lib/ReactWithAddons.js +5 -6
  105. package/lib/SVGDOMPropertyConfig.js +39 -4
  106. package/lib/SelectEventPlugin.js +31 -33
  107. package/lib/ServerReactRootIndex.js +2 -2
  108. package/lib/SimpleEventPlugin.js +138 -130
  109. package/lib/SyntheticClipboardEvent.js +5 -9
  110. package/lib/SyntheticCompositionEvent.js +4 -10
  111. package/lib/SyntheticDragEvent.js +3 -3
  112. package/lib/SyntheticEvent.js +14 -15
  113. package/lib/SyntheticFocusEvent.js +3 -3
  114. package/lib/SyntheticInputEvent.js +4 -10
  115. package/lib/SyntheticKeyboardEvent.js +6 -6
  116. package/lib/SyntheticMouseEvent.js +10 -16
  117. package/lib/SyntheticTouchEvent.js +3 -3
  118. package/lib/SyntheticUIEvent.js +5 -5
  119. package/lib/SyntheticWheelEvent.js +13 -17
  120. package/lib/Transaction.js +22 -28
  121. package/lib/ViewportMetrics.js +2 -2
  122. package/lib/accumulateInto.js +2 -5
  123. package/lib/adler32.js +2 -4
  124. package/lib/camelize.js +4 -2
  125. package/lib/camelizeStyleName.js +2 -2
  126. package/lib/cloneWithProps.js +6 -12
  127. package/lib/containsNode.js +29 -16
  128. package/lib/createArrayFromMixed.js +17 -16
  129. package/lib/createNodesFromMarkup.js +6 -8
  130. package/lib/dangerousStyleValue.js +2 -3
  131. package/lib/deprecated.js +47 -0
  132. package/lib/emptyFunction.js +10 -4
  133. package/lib/emptyObject.js +1 -1
  134. package/lib/escapeTextContentForBrowser.js +1 -1
  135. package/lib/findDOMNode.js +7 -27
  136. package/lib/flattenChildren.js +4 -10
  137. package/lib/focusNode.js +2 -3
  138. package/lib/forEachAccumulated.js +3 -3
  139. package/lib/getActiveElement.js +4 -2
  140. package/lib/getEventCharCode.js +2 -2
  141. package/lib/getEventKey.js +1 -1
  142. package/lib/getEventModifierState.js +1 -2
  143. package/lib/getEventTarget.js +1 -1
  144. package/lib/getIteratorFn.js +2 -4
  145. package/lib/getMarkupWrap.js +18 -40
  146. package/lib/getNodeForCharacterOffset.js +1 -1
  147. package/lib/getTextContentAccessor.js +2 -4
  148. package/lib/getUnboundedScrollPosition.js +1 -1
  149. package/lib/hyphenate.js +3 -1
  150. package/lib/hyphenateStyleName.js +2 -2
  151. package/lib/instantiateReactComponent.js +23 -43
  152. package/lib/invariant.js +8 -12
  153. package/lib/isEventSupported.js +7 -10
  154. package/lib/isNode.js +4 -6
  155. package/lib/isTextInputElement.js +3 -4
  156. package/lib/isTextNode.js +3 -1
  157. package/lib/joinClasses.js +3 -3
  158. package/lib/keyMirror.js +3 -6
  159. package/lib/keyOf.js +4 -3
  160. package/lib/mapObject.js +1 -1
  161. package/lib/memoizeStringOnly.js +2 -2
  162. package/lib/onlyChild.js +2 -5
  163. package/lib/performance.js +2 -5
  164. package/lib/performanceNow.js +3 -1
  165. package/lib/quoteAttributeValueForBrowser.js +1 -1
  166. package/lib/renderSubtreeIntoContainer.js +16 -0
  167. package/lib/setInnerHTML.js +11 -8
  168. package/lib/setTextContent.js +3 -3
  169. package/lib/shallowCompare.js +24 -0
  170. package/lib/shallowEqual.js +17 -11
  171. package/lib/shouldUpdateReactComponent.js +3 -64
  172. package/lib/toArray.js +8 -19
  173. package/lib/traverseAllChildren.js +23 -90
  174. package/lib/update.js +25 -85
  175. package/lib/validateDOMNesting.js +363 -0
  176. package/lib/warning.js +15 -17
  177. package/package.json +3 -3
  178. package/react.js +53 -1
  179. package/lib/LocalEventTrapMixin.js +0 -53
  180. package/lib/MobileSafariClickEventPlugin.js +0 -56
  181. package/lib/ReactContext.js +0 -74
  182. package/lib/ReactDOMForm.js +0 -47
  183. package/lib/ReactDOMIframe.js +0 -43
  184. package/lib/ReactDOMImg.js +0 -44
  185. package/lib/ReactLifeCycle.js +0 -35
  186. package/lib/ReactPutListenerQueue.js +0 -54
  187. package/lib/createFullPageComponent.js +0 -58
  188. package/lib/cx.js +0 -52
  189. package/lib/getReactRootElementInContainer.js +0 -33
@@ -79,12 +79,7 @@ function getModernOffsets(node) {
79
79
  // If the node and offset values are the same, the selection is collapsed.
80
80
  // `Selection.isCollapsed` is available natively, but IE sometimes gets
81
81
  // this value wrong.
82
- var isSelectionCollapsed = isCollapsed(
83
- selection.anchorNode,
84
- selection.anchorOffset,
85
- selection.focusNode,
86
- selection.focusOffset
87
- );
82
+ var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
88
83
 
89
84
  var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
90
85
 
@@ -92,12 +87,7 @@ function getModernOffsets(node) {
92
87
  tempRange.selectNodeContents(node);
93
88
  tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
94
89
 
95
- var isTempRangeCollapsed = isCollapsed(
96
- tempRange.startContainer,
97
- tempRange.startOffset,
98
- tempRange.endContainer,
99
- tempRange.endOffset
100
- );
90
+ var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
101
91
 
102
92
  var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
103
93
  var end = start + rangeLength;
@@ -160,8 +150,7 @@ function setModernOffsets(node, offsets) {
160
150
  var selection = window.getSelection();
161
151
  var length = node[getTextContentAccessor()].length;
162
152
  var start = Math.min(offsets.start, length);
163
- var end = typeof offsets.end === 'undefined' ?
164
- start : Math.min(offsets.end, length);
153
+ var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
165
154
 
166
155
  // IE 11 uses modern selection, but doesn't support the extend method.
167
156
  // Flip backward selections, so we can set with a single range.
@@ -189,11 +178,7 @@ function setModernOffsets(node, offsets) {
189
178
  }
190
179
  }
191
180
 
192
- var useIEOffsets = (
193
- ExecutionEnvironment.canUseDOM &&
194
- 'selection' in document &&
195
- !('getSelection' in window)
196
- );
181
+ var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
197
182
 
198
183
  var ReactDOMSelection = {
199
184
  /**
@@ -208,4 +193,4 @@ var ReactDOMSelection = {
208
193
  setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
209
194
  };
210
195
 
211
- module.exports = ReactDOMSelection;
196
+ module.exports = ReactDOMSelection;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright 2013-2015, 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
+
17
+ ReactDefaultInjection.inject();
18
+
19
+ var ReactDOMServer = {
20
+ renderToString: ReactServerRendering.renderToString,
21
+ renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup
22
+ };
23
+
24
+ module.exports = ReactDOMServer;
@@ -13,12 +13,12 @@
13
13
  'use strict';
14
14
 
15
15
  var DOMPropertyOperations = require("./DOMPropertyOperations");
16
- var ReactComponentBrowserEnvironment =
17
- require("./ReactComponentBrowserEnvironment");
16
+ var ReactComponentBrowserEnvironment = require("./ReactComponentBrowserEnvironment");
18
17
  var ReactDOMComponent = require("./ReactDOMComponent");
19
18
 
20
19
  var assign = require("./Object.assign");
21
20
  var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
21
+ var validateDOMNesting = require("./validateDOMNesting");
22
22
 
23
23
  /**
24
24
  * Text nodes violate a couple assumptions that React makes about components:
@@ -35,9 +35,7 @@ var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
35
35
  * @extends ReactComponent
36
36
  * @internal
37
37
  */
38
- var ReactDOMTextComponent = function(props) {
39
- // This constructor and its argument is currently used by mocks.
40
- };
38
+ var ReactDOMTextComponent = function (props) {};
41
39
 
42
40
  assign(ReactDOMTextComponent.prototype, {
43
41
 
@@ -45,7 +43,7 @@ assign(ReactDOMTextComponent.prototype, {
45
43
  * @param {ReactText} text
46
44
  * @internal
47
45
  */
48
- construct: function(text) {
46
+ construct: function (text) {
49
47
  // TODO: This is really a ReactText (ReactNode), not a ReactElement
50
48
  this._currentElement = text;
51
49
  this._stringText = '' + text;
@@ -64,7 +62,13 @@ assign(ReactDOMTextComponent.prototype, {
64
62
  * @return {string} Markup for this text node.
65
63
  * @internal
66
64
  */
67
- mountComponent: function(rootID, transaction, context) {
65
+ mountComponent: function (rootID, transaction, context) {
66
+ if ('production' !== process.env.NODE_ENV) {
67
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
68
+ validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
69
+ }
70
+ }
71
+
68
72
  this._rootNodeID = rootID;
69
73
  var escapedText = escapeTextContentForBrowser(this._stringText);
70
74
 
@@ -75,11 +79,7 @@ assign(ReactDOMTextComponent.prototype, {
75
79
  return escapedText;
76
80
  }
77
81
 
78
- return (
79
- '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
80
- escapedText +
81
- '</span>'
82
- );
82
+ return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
83
83
  },
84
84
 
85
85
  /**
@@ -89,7 +89,7 @@ assign(ReactDOMTextComponent.prototype, {
89
89
  * @param {ReactReconcileTransaction} transaction
90
90
  * @internal
91
91
  */
92
- receiveComponent: function(nextText, transaction) {
92
+ receiveComponent: function (nextText, transaction) {
93
93
  if (nextText !== this._currentElement) {
94
94
  this._currentElement = nextText;
95
95
  var nextStringText = '' + nextText;
@@ -98,18 +98,17 @@ assign(ReactDOMTextComponent.prototype, {
98
98
  // and/or updateComponent to do the actual update for consistency with
99
99
  // other component types?
100
100
  this._stringText = nextStringText;
101
- ReactDOMComponent.BackendIDOperations.updateTextContentByID(
102
- this._rootNodeID,
103
- nextStringText
104
- );
101
+ ReactDOMComponent.BackendIDOperations.updateTextContentByID(this._rootNodeID, nextStringText);
105
102
  }
106
103
  }
107
104
  },
108
105
 
109
- unmountComponent: function() {
106
+ unmountComponent: function () {
110
107
  ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
111
108
  }
112
109
 
113
110
  });
114
111
 
115
112
  module.exports = ReactDOMTextComponent;
113
+
114
+ // This constructor and its argument is currently used by mocks.
@@ -11,25 +11,18 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var AutoFocusMixin = require("./AutoFocusMixin");
15
- var DOMPropertyOperations = require("./DOMPropertyOperations");
16
14
  var LinkedValueUtils = require("./LinkedValueUtils");
17
- var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
18
- var ReactClass = require("./ReactClass");
19
- var ReactElement = require("./ReactElement");
15
+ var ReactDOMIDOperations = require("./ReactDOMIDOperations");
20
16
  var ReactUpdates = require("./ReactUpdates");
21
17
 
22
18
  var assign = require("./Object.assign");
23
19
  var invariant = require("./invariant");
24
-
25
20
  var warning = require("./warning");
26
21
 
27
- var textarea = ReactElement.createFactory('textarea');
28
-
29
22
  function forceUpdateIfMounted() {
30
- /*jshint validthis:true */
31
- if (this.isMounted()) {
32
- this.forceUpdate();
23
+ if (this._rootNodeID) {
24
+ // DOM component is still mounted; update
25
+ ReactDOMTextarea.updateWrapper(this);
33
26
  }
34
27
  }
35
28
 
@@ -48,33 +41,35 @@ function forceUpdateIfMounted() {
48
41
  * The rendered element will be initialized with an empty value, the prop
49
42
  * `defaultValue` if specified, or the children content (deprecated).
50
43
  */
51
- var ReactDOMTextarea = ReactClass.createClass({
52
- displayName: 'ReactDOMTextarea',
53
- tagName: 'TEXTAREA',
44
+ var ReactDOMTextarea = {
45
+ getNativeProps: function (inst, props, context) {
46
+ !(props.dangerouslySetInnerHTML == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
54
47
 
55
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
48
+ // Always set children to the same thing. In IE9, the selection range will
49
+ // get reset if `textContent` is mutated.
50
+ var nativeProps = assign({}, props, {
51
+ defaultValue: undefined,
52
+ value: undefined,
53
+ children: inst._wrapperState.initialValue,
54
+ onChange: inst._wrapperState.onChange
55
+ });
56
+
57
+ return nativeProps;
58
+ },
56
59
 
57
- getInitialState: function() {
58
- var defaultValue = this.props.defaultValue;
60
+ mountWrapper: function (inst, props) {
61
+ LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
62
+
63
+ var defaultValue = props.defaultValue;
59
64
  // TODO (yungsters): Remove support for children content in <textarea>.
60
- var children = this.props.children;
65
+ var children = props.children;
61
66
  if (children != null) {
62
- if ("production" !== process.env.NODE_ENV) {
63
- ("production" !== process.env.NODE_ENV ? warning(
64
- false,
65
- 'Use the `defaultValue` or `value` props instead of setting ' +
66
- 'children on <textarea>.'
67
- ) : null);
67
+ if ('production' !== process.env.NODE_ENV) {
68
+ 'production' !== process.env.NODE_ENV ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
68
69
  }
69
- ("production" !== process.env.NODE_ENV ? invariant(
70
- defaultValue == null,
71
- 'If you supply `defaultValue` on a <textarea>, do not pass children.'
72
- ) : invariant(defaultValue == null));
70
+ !(defaultValue == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
73
71
  if (Array.isArray(children)) {
74
- ("production" !== process.env.NODE_ENV ? invariant(
75
- children.length <= 1,
76
- '<textarea> can only have at most one child.'
77
- ) : invariant(children.length <= 1));
72
+ !(children.length <= 1) ? 'production' !== process.env.NODE_ENV ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
78
73
  children = children[0];
79
74
  }
80
75
 
@@ -83,54 +78,34 @@ var ReactDOMTextarea = ReactClass.createClass({
83
78
  if (defaultValue == null) {
84
79
  defaultValue = '';
85
80
  }
86
- var value = LinkedValueUtils.getValue(this);
87
- return {
81
+ var value = LinkedValueUtils.getValue(props);
82
+
83
+ inst._wrapperState = {
88
84
  // We save the initial value so that `ReactDOMComponent` doesn't update
89
85
  // `textContent` (unnecessary since we update value).
90
86
  // The initial value can be a boolean or object so that's why it's
91
87
  // forced to be a string.
92
- initialValue: '' + (value != null ? value : defaultValue)
88
+ initialValue: '' + (value != null ? value : defaultValue),
89
+ onChange: _handleChange.bind(inst)
93
90
  };
94
91
  },
95
92
 
96
- render: function() {
97
- // Clone `this.props` so we don't mutate the input.
98
- var props = assign({}, this.props);
99
-
100
- ("production" !== process.env.NODE_ENV ? invariant(
101
- props.dangerouslySetInnerHTML == null,
102
- '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
103
- ) : invariant(props.dangerouslySetInnerHTML == null));
104
-
105
- props.defaultValue = null;
106
- props.value = null;
107
- props.onChange = this._handleChange;
108
-
109
- // Always set children to the same thing. In IE9, the selection range will
110
- // get reset if `textContent` is mutated.
111
- return textarea(props, this.state.initialValue);
112
- },
113
-
114
- componentDidUpdate: function(prevProps, prevState, prevContext) {
115
- var value = LinkedValueUtils.getValue(this);
93
+ updateWrapper: function (inst) {
94
+ var props = inst._currentElement.props;
95
+ var value = LinkedValueUtils.getValue(props);
116
96
  if (value != null) {
117
- var rootNode = this.getDOMNode();
118
97
  // Cast `value` to a string to ensure the value is set correctly. While
119
98
  // browsers typically do this as necessary, jsdom doesn't.
120
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
99
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
121
100
  }
122
- },
123
-
124
- _handleChange: function(event) {
125
- var returnValue;
126
- var onChange = LinkedValueUtils.getOnChange(this);
127
- if (onChange) {
128
- returnValue = onChange.call(this, event);
129
- }
130
- ReactUpdates.asap(forceUpdateIfMounted, this);
131
- return returnValue;
132
101
  }
102
+ };
133
103
 
134
- });
104
+ function _handleChange(event) {
105
+ var props = this._currentElement.props;
106
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
107
+ ReactUpdates.asap(forceUpdateIfMounted, this);
108
+ return returnValue;
109
+ }
135
110
 
136
- module.exports = ReactDOMTextarea;
111
+ module.exports = ReactDOMTextarea;
@@ -19,7 +19,7 @@ var emptyFunction = require("./emptyFunction");
19
19
 
20
20
  var RESET_BATCHED_UPDATES = {
21
21
  initialize: emptyFunction,
22
- close: function() {
22
+ close: function () {
23
23
  ReactDefaultBatchingStrategy.isBatchingUpdates = false;
24
24
  }
25
25
  };
@@ -35,15 +35,11 @@ function ReactDefaultBatchingStrategyTransaction() {
35
35
  this.reinitializeTransaction();
36
36
  }
37
37
 
38
- assign(
39
- ReactDefaultBatchingStrategyTransaction.prototype,
40
- Transaction.Mixin,
41
- {
42
- getTransactionWrappers: function() {
43
- return TRANSACTION_WRAPPERS;
44
- }
38
+ assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
39
+ getTransactionWrappers: function () {
40
+ return TRANSACTION_WRAPPERS;
45
41
  }
46
- );
42
+ });
47
43
 
48
44
  var transaction = new ReactDefaultBatchingStrategyTransaction();
49
45
 
@@ -54,18 +50,18 @@ var ReactDefaultBatchingStrategy = {
54
50
  * Call the provided function in a context within which calls to `setState`
55
51
  * and friends are batched such that components aren't updated unnecessarily.
56
52
  */
57
- batchedUpdates: function(callback, a, b, c, d) {
53
+ batchedUpdates: function (callback, a, b, c, d, e) {
58
54
  var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
59
55
 
60
56
  ReactDefaultBatchingStrategy.isBatchingUpdates = true;
61
57
 
62
58
  // The code is written this way to avoid extra allocations
63
59
  if (alreadyBatchingUpdates) {
64
- callback(a, b, c, d);
60
+ callback(a, b, c, d, e);
65
61
  } else {
66
- transaction.perform(callback, null, a, b, c, d);
62
+ transaction.perform(callback, null, a, b, c, d, e);
67
63
  }
68
64
  }
69
65
  };
70
66
 
71
- module.exports = ReactDefaultBatchingStrategy;
67
+ module.exports = ReactDefaultBatchingStrategy;
@@ -18,24 +18,12 @@ var DefaultEventPluginOrder = require("./DefaultEventPluginOrder");
18
18
  var EnterLeaveEventPlugin = require("./EnterLeaveEventPlugin");
19
19
  var ExecutionEnvironment = require("./ExecutionEnvironment");
20
20
  var HTMLDOMPropertyConfig = require("./HTMLDOMPropertyConfig");
21
- var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin");
22
21
  var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
23
- var ReactClass = require("./ReactClass");
24
- var ReactComponentBrowserEnvironment =
25
- require("./ReactComponentBrowserEnvironment");
22
+ var ReactComponentBrowserEnvironment = require("./ReactComponentBrowserEnvironment");
26
23
  var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
27
24
  var ReactDOMComponent = require("./ReactDOMComponent");
28
- var ReactDOMButton = require("./ReactDOMButton");
29
- var ReactDOMForm = require("./ReactDOMForm");
30
- var ReactDOMImg = require("./ReactDOMImg");
31
25
  var ReactDOMIDOperations = require("./ReactDOMIDOperations");
32
- var ReactDOMIframe = require("./ReactDOMIframe");
33
- var ReactDOMInput = require("./ReactDOMInput");
34
- var ReactDOMOption = require("./ReactDOMOption");
35
- var ReactDOMSelect = require("./ReactDOMSelect");
36
- var ReactDOMTextarea = require("./ReactDOMTextarea");
37
26
  var ReactDOMTextComponent = require("./ReactDOMTextComponent");
38
- var ReactElement = require("./ReactElement");
39
27
  var ReactEventListener = require("./ReactEventListener");
40
28
  var ReactInjection = require("./ReactInjection");
41
29
  var ReactInstanceHandles = require("./ReactInstanceHandles");
@@ -46,28 +34,18 @@ var ServerReactRootIndex = require("./ServerReactRootIndex");
46
34
  var SimpleEventPlugin = require("./SimpleEventPlugin");
47
35
  var SVGDOMPropertyConfig = require("./SVGDOMPropertyConfig");
48
36
 
49
- var createFullPageComponent = require("./createFullPageComponent");
50
-
51
- function autoGenerateWrapperClass(type) {
52
- return ReactClass.createClass({
53
- tagName: type.toUpperCase(),
54
- render: function() {
55
- return new ReactElement(
56
- type,
57
- null,
58
- null,
59
- null,
60
- null,
61
- this.props
62
- );
63
- }
64
- });
65
- }
37
+ var alreadyInjected = false;
66
38
 
67
39
  function inject() {
68
- ReactInjection.EventEmitter.injectReactEventListener(
69
- ReactEventListener
70
- );
40
+ if (alreadyInjected) {
41
+ // TODO: This is currently true because these injections are shared between
42
+ // the client and the server package. They should be built independently
43
+ // and not share any injection state. Then this problem will be solved.
44
+ return;
45
+ }
46
+ alreadyInjected = true;
47
+
48
+ ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
71
49
 
72
50
  /**
73
51
  * Inject modules for resolving DOM hierarchy and plugin ordering.
@@ -84,66 +62,32 @@ function inject() {
84
62
  SimpleEventPlugin: SimpleEventPlugin,
85
63
  EnterLeaveEventPlugin: EnterLeaveEventPlugin,
86
64
  ChangeEventPlugin: ChangeEventPlugin,
87
- MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
88
65
  SelectEventPlugin: SelectEventPlugin,
89
66
  BeforeInputEventPlugin: BeforeInputEventPlugin
90
67
  });
91
68
 
92
- ReactInjection.NativeComponent.injectGenericComponentClass(
93
- ReactDOMComponent
94
- );
95
-
96
- ReactInjection.NativeComponent.injectTextComponentClass(
97
- ReactDOMTextComponent
98
- );
69
+ ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
99
70
 
100
- ReactInjection.NativeComponent.injectAutoWrapper(
101
- autoGenerateWrapperClass
102
- );
71
+ ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
103
72
 
104
- // This needs to happen before createFullPageComponent() otherwise the mixin
105
- // won't be included.
106
73
  ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
107
74
 
108
- ReactInjection.NativeComponent.injectComponentClasses({
109
- 'button': ReactDOMButton,
110
- 'form': ReactDOMForm,
111
- 'iframe': ReactDOMIframe,
112
- 'img': ReactDOMImg,
113
- 'input': ReactDOMInput,
114
- 'option': ReactDOMOption,
115
- 'select': ReactDOMSelect,
116
- 'textarea': ReactDOMTextarea,
117
-
118
- 'html': createFullPageComponent('html'),
119
- 'head': createFullPageComponent('head'),
120
- 'body': createFullPageComponent('body')
121
- });
122
-
123
75
  ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
124
76
  ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
125
77
 
126
78
  ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
127
79
 
128
- ReactInjection.Updates.injectReconcileTransaction(
129
- ReactReconcileTransaction
130
- );
131
- ReactInjection.Updates.injectBatchingStrategy(
132
- ReactDefaultBatchingStrategy
133
- );
80
+ ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
81
+ ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
134
82
 
135
- ReactInjection.RootIndex.injectCreateReactRootIndex(
136
- ExecutionEnvironment.canUseDOM ?
137
- ClientReactRootIndex.createReactRootIndex :
138
- ServerReactRootIndex.createReactRootIndex
139
- );
83
+ ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
140
84
 
141
85
  ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
142
86
  ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
143
87
 
144
- if ("production" !== process.env.NODE_ENV) {
145
- var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
146
- if ((/[?&]react_perf\b/).test(url)) {
88
+ if ('production' !== process.env.NODE_ENV) {
89
+ var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
90
+ if (/[?&]react_perf\b/.test(url)) {
147
91
  var ReactDefaultPerf = require("./ReactDefaultPerf");
148
92
  ReactDefaultPerf.start();
149
93
  }
@@ -152,4 +96,4 @@ function inject() {
152
96
 
153
97
  module.exports = {
154
98
  inject: inject
155
- };
99
+ };