react 0.13.3 → 0.14.0-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/addons.js +7 -0
  2. package/addons/CSSTransitionGroup.js +1 -0
  3. package/addons/LinkedStateMixin.js +1 -0
  4. package/addons/Perf.js +1 -0
  5. package/addons/PureRenderMixin.js +1 -0
  6. package/addons/TestUtils.js +1 -0
  7. package/addons/TransitionGroup.js +1 -0
  8. package/addons/batchedUpdates.js +1 -0
  9. package/addons/cloneWithProps.js +1 -0
  10. package/addons/createFragment.js +1 -0
  11. package/addons/renderSubtreeIntoContainer.js +1 -0
  12. package/addons/shallowCompare.js +1 -0
  13. package/addons/update.js +1 -0
  14. package/dist/JSXTransformer.js +3355 -1685
  15. package/dist/react-with-addons.js +3092 -5145
  16. package/dist/react-with-addons.min.js +6 -8
  17. package/dist/react.js +2772 -4594
  18. package/dist/react.min.js +5 -6
  19. package/lib/AutoFocusMixin.js +4 -3
  20. package/lib/BeforeInputEventPlugin.js +30 -118
  21. package/lib/CSSCore.js +12 -23
  22. package/lib/CSSProperty.js +4 -3
  23. package/lib/CSSPropertyOperations.js +14 -30
  24. package/lib/CallbackQueue.js +7 -10
  25. package/lib/ChangeEventPlugin.js +24 -88
  26. package/lib/ClientReactRootIndex.js +2 -2
  27. package/lib/DOMChildrenOperations.js +13 -33
  28. package/lib/DOMProperty.js +41 -65
  29. package/lib/DOMPropertyOperations.js +30 -51
  30. package/lib/Danger.js +19 -60
  31. package/lib/DefaultEventPluginOrder.js +2 -12
  32. package/lib/EnterLeaveEventPlugin.js +11 -33
  33. package/lib/EventConstants.js +2 -2
  34. package/lib/EventListener.js +11 -13
  35. package/lib/EventPluginHub.js +44 -47
  36. package/lib/EventPluginRegistry.js +18 -74
  37. package/lib/EventPluginUtils.js +27 -38
  38. package/lib/EventPropagators.js +23 -26
  39. package/lib/ExecutionEnvironment.js +4 -8
  40. package/lib/FallbackCompositionState.js +3 -3
  41. package/lib/HTMLDOMPropertyConfig.js +5 -17
  42. package/lib/LinkedStateMixin.js +3 -6
  43. package/lib/LinkedValueUtils.js +34 -64
  44. package/lib/LocalEventTrapMixin.js +9 -16
  45. package/lib/Object.assign.js +1 -1
  46. package/lib/PooledClass.js +8 -11
  47. package/lib/React.js +20 -38
  48. package/lib/ReactBrowserComponentMixin.js +9 -2
  49. package/lib/ReactBrowserEventEmitter.js +26 -82
  50. package/lib/ReactCSSTransitionGroup.js +13 -24
  51. package/lib/ReactCSSTransitionGroupChild.js +18 -28
  52. package/lib/ReactChildReconciler.js +11 -19
  53. package/lib/ReactChildren.js +7 -16
  54. package/lib/ReactClass.js +78 -231
  55. package/lib/ReactComponent.js +17 -51
  56. package/lib/ReactComponentBrowserEnvironment.js +4 -6
  57. package/lib/ReactComponentEnvironment.js +6 -12
  58. package/lib/ReactComponentWithPureRenderMixin.js +4 -5
  59. package/lib/ReactCompositeComponent.js +83 -318
  60. package/lib/ReactContext.js +2 -44
  61. package/lib/ReactCurrentOwner.js +1 -3
  62. package/lib/ReactDOM.js +3 -2
  63. package/lib/ReactDOMButton.js +3 -4
  64. package/lib/ReactDOMComponent.js +182 -148
  65. package/lib/ReactDOMForm.js +3 -3
  66. package/lib/ReactDOMIDOperations.js +11 -20
  67. package/lib/ReactDOMIframe.js +3 -3
  68. package/lib/ReactDOMImg.js +3 -3
  69. package/lib/ReactDOMInput.js +22 -35
  70. package/lib/ReactDOMOption.js +52 -10
  71. package/lib/ReactDOMSelect.js +50 -28
  72. package/lib/ReactDOMSelection.js +5 -20
  73. package/lib/ReactDOMTextComponent.js +17 -18
  74. package/lib/ReactDOMTextarea.js +15 -27
  75. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  76. package/lib/ReactDefaultInjection.js +21 -40
  77. package/lib/ReactDefaultPerf.js +36 -69
  78. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  79. package/lib/ReactElement.js +35 -72
  80. package/lib/ReactElementValidator.js +51 -110
  81. package/lib/ReactEmptyComponent.js +7 -11
  82. package/lib/ReactErrorUtils.js +2 -2
  83. package/lib/ReactEventEmitterMixin.js +3 -12
  84. package/lib/ReactEventListener.js +16 -38
  85. package/lib/ReactFragment.js +23 -54
  86. package/lib/ReactInjection.js +1 -1
  87. package/lib/ReactInputSelection.js +11 -21
  88. package/lib/ReactInstanceHandles.js +27 -57
  89. package/lib/ReactInstanceMap.js +5 -5
  90. package/lib/ReactLifeCycle.js +1 -1
  91. package/lib/ReactLink.js +2 -4
  92. package/lib/ReactMarkupChecksum.js +5 -10
  93. package/lib/ReactMount.js +136 -260
  94. package/lib/ReactMultiChild.js +19 -45
  95. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  96. package/lib/ReactNativeComponent.js +7 -11
  97. package/lib/ReactOwner.js +7 -24
  98. package/lib/ReactPerf.js +8 -12
  99. package/lib/ReactPropTransferer.js +4 -4
  100. package/lib/ReactPropTypeLocationNames.js +2 -2
  101. package/lib/ReactPropTypeLocations.js +1 -1
  102. package/lib/ReactPropTypes.js +13 -46
  103. package/lib/ReactReconcileTransaction.js +9 -34
  104. package/lib/ReactReconciler.js +9 -19
  105. package/lib/ReactRef.js +5 -8
  106. package/lib/ReactRootIndex.js +2 -2
  107. package/lib/ReactServerRendering.js +7 -15
  108. package/lib/ReactServerRenderingTransaction.js +7 -32
  109. package/lib/ReactStateSetters.js +6 -6
  110. package/lib/ReactTestUtils.js +89 -165
  111. package/lib/ReactTransitionChildMapping.js +5 -7
  112. package/lib/ReactTransitionEvents.js +5 -5
  113. package/lib/ReactTransitionGroup.js +30 -52
  114. package/lib/ReactUpdateQueue.js +27 -90
  115. package/lib/ReactUpdates.js +27 -79
  116. package/lib/ReactWithAddons.js +7 -6
  117. package/lib/SVGDOMPropertyConfig.js +39 -2
  118. package/lib/SelectEventPlugin.js +28 -29
  119. package/lib/ServerReactRootIndex.js +2 -2
  120. package/lib/SimpleEventPlugin.js +136 -128
  121. package/lib/SyntheticClipboardEvent.js +3 -7
  122. package/lib/SyntheticCompositionEvent.js +3 -9
  123. package/lib/SyntheticDragEvent.js +1 -1
  124. package/lib/SyntheticEvent.js +8 -10
  125. package/lib/SyntheticFocusEvent.js +1 -1
  126. package/lib/SyntheticInputEvent.js +3 -9
  127. package/lib/SyntheticKeyboardEvent.js +4 -4
  128. package/lib/SyntheticMouseEvent.js +8 -14
  129. package/lib/SyntheticTouchEvent.js +1 -1
  130. package/lib/SyntheticUIEvent.js +3 -3
  131. package/lib/SyntheticWheelEvent.js +11 -15
  132. package/lib/Transaction.js +12 -24
  133. package/lib/ViewportMetrics.js +2 -2
  134. package/lib/accumulateInto.js +2 -5
  135. package/lib/adler32.js +2 -2
  136. package/lib/camelize.js +4 -2
  137. package/lib/camelizeStyleName.js +2 -2
  138. package/lib/cloneWithProps.js +5 -11
  139. package/lib/containsNode.js +29 -16
  140. package/lib/createArrayFromMixed.js +17 -16
  141. package/lib/createFullPageComponent.js +4 -11
  142. package/lib/createNodesFromMarkup.js +6 -8
  143. package/lib/dangerousStyleValue.js +2 -3
  144. package/lib/emptyFunction.js +10 -4
  145. package/lib/emptyObject.js +1 -1
  146. package/lib/escapeTextContentForBrowser.js +1 -1
  147. package/lib/findDOMNode.js +5 -24
  148. package/lib/flattenChildren.js +4 -10
  149. package/lib/focusNode.js +2 -3
  150. package/lib/forEachAccumulated.js +2 -2
  151. package/lib/getActiveElement.js +4 -2
  152. package/lib/getEventCharCode.js +1 -1
  153. package/lib/getEventKey.js +1 -1
  154. package/lib/getEventModifierState.js +1 -1
  155. package/lib/getEventTarget.js +1 -1
  156. package/lib/getIteratorFn.js +2 -4
  157. package/lib/getMarkupWrap.js +5 -5
  158. package/lib/getNodeForCharacterOffset.js +1 -1
  159. package/lib/getTextContentAccessor.js +2 -4
  160. package/lib/getUnboundedScrollPosition.js +1 -1
  161. package/lib/hyphenate.js +3 -1
  162. package/lib/hyphenateStyleName.js +2 -2
  163. package/lib/instantiateReactComponent.js +14 -38
  164. package/lib/invariant.js +8 -12
  165. package/lib/isEventSupported.js +7 -10
  166. package/lib/isNode.js +4 -6
  167. package/lib/isTextInputElement.js +2 -4
  168. package/lib/isTextNode.js +3 -1
  169. package/lib/joinClasses.js +2 -2
  170. package/lib/keyMirror.js +3 -6
  171. package/lib/keyOf.js +4 -3
  172. package/lib/mapObject.js +1 -1
  173. package/lib/memoizeStringOnly.js +2 -2
  174. package/lib/onlyChild.js +2 -5
  175. package/lib/performance.js +2 -5
  176. package/lib/performanceNow.js +3 -1
  177. package/lib/quoteAttributeValueForBrowser.js +1 -1
  178. package/lib/renderSubtreeIntoContainer.js +16 -0
  179. package/lib/setInnerHTML.js +11 -8
  180. package/lib/setTextContent.js +3 -3
  181. package/lib/shallowCompare.js +24 -0
  182. package/lib/shallowEqual.js +17 -11
  183. package/lib/shouldUpdateReactComponent.js +3 -64
  184. package/lib/toArray.js +8 -19
  185. package/lib/traverseAllChildren.js +19 -82
  186. package/lib/update.js +25 -85
  187. package/lib/validateDOMNesting.js +264 -0
  188. package/lib/warning.js +17 -15
  189. package/package.json +3 -3
  190. package/lib/MobileSafariClickEventPlugin.js +0 -56
  191. package/lib/ReactPutListenerQueue.js +0 -54
  192. package/lib/cx.js +0 -52
  193. package/lib/getReactRootElementInContainer.js +0 -33
@@ -49,22 +49,10 @@ function ReactComponent(props, context) {
49
49
  * @final
50
50
  * @protected
51
51
  */
52
- ReactComponent.prototype.setState = function(partialState, callback) {
53
- ("production" !== process.env.NODE_ENV ? invariant(
54
- typeof partialState === 'object' ||
55
- typeof partialState === 'function' ||
56
- partialState == null,
57
- 'setState(...): takes an object of state variables to update or a ' +
58
- 'function which returns an object of state variables.'
59
- ) : invariant(typeof partialState === 'object' ||
60
- typeof partialState === 'function' ||
61
- partialState == null));
62
- if ("production" !== process.env.NODE_ENV) {
63
- ("production" !== process.env.NODE_ENV ? warning(
64
- partialState != null,
65
- 'setState(...): You passed an undefined or null state object; ' +
66
- 'instead, use forceUpdate().'
67
- ) : null);
52
+ ReactComponent.prototype.setState = function (partialState, callback) {
53
+ 'production' !== process.env.NODE_ENV ? invariant(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null);
54
+ if ('production' !== process.env.NODE_ENV) {
55
+ 'production' !== process.env.NODE_ENV ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : null;
68
56
  }
69
57
  ReactUpdateQueue.enqueueSetState(this, partialState);
70
58
  if (callback) {
@@ -86,7 +74,7 @@ ReactComponent.prototype.setState = function(partialState, callback) {
86
74
  * @final
87
75
  * @protected
88
76
  */
89
- ReactComponent.prototype.forceUpdate = function(callback) {
77
+ ReactComponent.prototype.forceUpdate = function (callback) {
90
78
  ReactUpdateQueue.enqueueForceUpdate(this);
91
79
  if (callback) {
92
80
  ReactUpdateQueue.enqueueCallback(this, callback);
@@ -98,47 +86,23 @@ ReactComponent.prototype.forceUpdate = function(callback) {
98
86
  * we would like to deprecate them, we're not going to move them over to this
99
87
  * modern base class. Instead, we define a getter that warns if it's accessed.
100
88
  */
101
- if ("production" !== process.env.NODE_ENV) {
89
+ if ('production' !== process.env.NODE_ENV) {
102
90
  var deprecatedAPIs = {
103
- getDOMNode: [
104
- 'getDOMNode',
105
- 'Use React.findDOMNode(component) instead.'
106
- ],
107
- isMounted: [
108
- 'isMounted',
109
- 'Instead, make sure to clean up subscriptions and pending requests in ' +
110
- 'componentWillUnmount to prevent memory leaks.'
111
- ],
112
- replaceProps: [
113
- 'replaceProps',
114
- 'Instead, call React.render again at the top level.'
115
- ],
116
- replaceState: [
117
- 'replaceState',
118
- 'Refactor your code to use setState instead (see ' +
119
- 'https://github.com/facebook/react/issues/3236).'
120
- ],
121
- setProps: [
122
- 'setProps',
123
- 'Instead, call React.render again at the top level.'
124
- ]
91
+ getDOMNode: ['getDOMNode', 'Use React.findDOMNode(component) instead.'],
92
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
93
+ replaceProps: ['replaceProps', 'Instead, call React.render again at the top level.'],
94
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
95
+ setProps: ['setProps', 'Instead, call React.render again at the top level.']
125
96
  };
126
- var defineDeprecationWarning = function(methodName, info) {
97
+ var defineDeprecationWarning = function (methodName, info) {
127
98
  try {
128
99
  Object.defineProperty(ReactComponent.prototype, methodName, {
129
- get: function() {
130
- ("production" !== process.env.NODE_ENV ? warning(
131
- false,
132
- '%s(...) is deprecated in plain JavaScript React classes. %s',
133
- info[0],
134
- info[1]
135
- ) : null);
100
+ get: function () {
101
+ 'production' !== process.env.NODE_ENV ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : null;
136
102
  return undefined;
137
103
  }
138
104
  });
139
- } catch (x) {
140
- // IE will fail on defineProperty (es5-shim/sham too)
141
- }
105
+ } catch (x) {}
142
106
  };
143
107
  for (var fnName in deprecatedAPIs) {
144
108
  if (deprecatedAPIs.hasOwnProperty(fnName)) {
@@ -148,3 +112,5 @@ if ("production" !== process.env.NODE_ENV) {
148
112
  }
149
113
 
150
114
  module.exports = ReactComponent;
115
+
116
+ // IE will fail on defineProperty (es5-shim/sham too)
@@ -23,11 +23,9 @@ var ReactMount = require("./ReactMount");
23
23
  */
24
24
  var ReactComponentBrowserEnvironment = {
25
25
 
26
- processChildrenUpdates:
27
- ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
26
+ processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
28
27
 
29
- replaceNodeWithMarkupByID:
30
- ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
28
+ replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
31
29
 
32
30
  /**
33
31
  * If a particular environment requires that some resources be cleaned up,
@@ -36,10 +34,10 @@ var ReactComponentBrowserEnvironment = {
36
34
  *
37
35
  * @private
38
36
  */
39
- unmountIDFromEnvironment: function(rootNodeID) {
37
+ unmountIDFromEnvironment: function (rootNodeID) {
40
38
  ReactMount.purgeID(rootNodeID);
41
39
  }
42
40
 
43
41
  };
44
42
 
45
- module.exports = ReactComponentBrowserEnvironment;
43
+ module.exports = ReactComponentBrowserEnvironment;
@@ -37,21 +37,15 @@ var ReactComponentEnvironment = {
37
37
  processChildrenUpdates: null,
38
38
 
39
39
  injection: {
40
- injectEnvironment: function(environment) {
41
- ("production" !== process.env.NODE_ENV ? invariant(
42
- !injected,
43
- 'ReactCompositeComponent: injectEnvironment() can only be called once.'
44
- ) : invariant(!injected));
45
- ReactComponentEnvironment.unmountIDFromEnvironment =
46
- environment.unmountIDFromEnvironment;
47
- ReactComponentEnvironment.replaceNodeWithMarkupByID =
48
- environment.replaceNodeWithMarkupByID;
49
- ReactComponentEnvironment.processChildrenUpdates =
50
- environment.processChildrenUpdates;
40
+ injectEnvironment: function (environment) {
41
+ 'production' !== process.env.NODE_ENV ? invariant(!injected, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(!injected);
42
+ ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
43
+ ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
44
+ ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
51
45
  injected = true;
52
46
  }
53
47
  }
54
48
 
55
49
  };
56
50
 
57
- module.exports = ReactComponentEnvironment;
51
+ module.exports = ReactComponentEnvironment;
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var shallowEqual = require("./shallowEqual");
14
+ var shallowCompare = require("./shallowCompare");
15
15
 
16
16
  /**
17
17
  * If your React component's render function is "pure", e.g. it will render the
@@ -38,10 +38,9 @@ var shallowEqual = require("./shallowEqual");
38
38
  * use `forceUpdate()` when you know deep data structures have changed.
39
39
  */
40
40
  var ReactComponentWithPureRenderMixin = {
41
- shouldComponentUpdate: function(nextProps, nextState) {
42
- return !shallowEqual(this.props, nextProps) ||
43
- !shallowEqual(this.state, nextState);
41
+ shouldComponentUpdate: function (nextProps, nextState) {
42
+ return shallowCompare(this, nextProps, nextState);
44
43
  }
45
44
  };
46
45
 
47
- module.exports = ReactComponentWithPureRenderMixin;
46
+ module.exports = ReactComponentWithPureRenderMixin;
@@ -89,7 +89,7 @@ var ReactCompositeComponentMixin = {
89
89
  * @final
90
90
  * @internal
91
91
  */
92
- construct: function(element) {
92
+ construct: function (element) {
93
93
  this._currentElement = element;
94
94
  this._rootNodeID = null;
95
95
  this._instance = null;
@@ -119,32 +119,23 @@ var ReactCompositeComponentMixin = {
119
119
  * @final
120
120
  * @internal
121
121
  */
122
- mountComponent: function(rootID, transaction, context) {
122
+ mountComponent: function (rootID, transaction, context) {
123
123
  this._context = context;
124
124
  this._mountOrder = nextMountID++;
125
125
  this._rootNodeID = rootID;
126
126
 
127
127
  var publicProps = this._processProps(this._currentElement.props);
128
- var publicContext = this._processContext(this._currentElement._context);
128
+ var publicContext = this._processContext(context);
129
129
 
130
- var Component = ReactNativeComponent.getComponentClassForElement(
131
- this._currentElement
132
- );
130
+ var Component = ReactNativeComponent.getComponentClassForElement(this._currentElement);
133
131
 
134
132
  // Initialize the public class
135
133
  var inst = new Component(publicProps, publicContext);
136
134
 
137
- if ("production" !== process.env.NODE_ENV) {
135
+ if ('production' !== process.env.NODE_ENV) {
138
136
  // This will throw later in _renderValidatedComponent, but add an early
139
137
  // warning now to help debugging
140
- ("production" !== process.env.NODE_ENV ? warning(
141
- inst.render != null,
142
- '%s(...): No `render` method found on the returned component ' +
143
- 'instance: you may have forgotten to define `render` in your ' +
144
- 'component or you may have accidentally tried to render an element ' +
145
- 'whose type is a function that isn\'t a React component.',
146
- Component.displayName || Component.name || 'Component'
147
- ) : null);
138
+ 'production' !== process.env.NODE_ENV ? warning(inst.render != null, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render` in your ' + 'component or you may have accidentally tried to render an element ' + 'whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : null;
148
139
  }
149
140
 
150
141
  // These should be set up in the constructor, but as a convenience for
@@ -158,67 +149,27 @@ var ReactCompositeComponentMixin = {
158
149
  // Store a reference from the instance back to the internal representation
159
150
  ReactInstanceMap.set(inst, this);
160
151
 
161
- if ("production" !== process.env.NODE_ENV) {
162
- this._warnIfContextsDiffer(this._currentElement._context, context);
163
- }
164
-
165
- if ("production" !== process.env.NODE_ENV) {
152
+ if ('production' !== process.env.NODE_ENV) {
166
153
  // Since plain JS classes are defined without any special initialization
167
154
  // logic, we can not catch common errors early. Therefore, we have to
168
155
  // catch them here, at initialization time, instead.
169
- ("production" !== process.env.NODE_ENV ? warning(
170
- !inst.getInitialState ||
171
- inst.getInitialState.isReactClassApproved,
172
- 'getInitialState was defined on %s, a plain JavaScript class. ' +
173
- 'This is only supported for classes created using React.createClass. ' +
174
- 'Did you mean to define a state property instead?',
175
- this.getName() || 'a component'
176
- ) : null);
177
- ("production" !== process.env.NODE_ENV ? warning(
178
- !inst.getDefaultProps ||
179
- inst.getDefaultProps.isReactClassApproved,
180
- 'getDefaultProps was defined on %s, a plain JavaScript class. ' +
181
- 'This is only supported for classes created using React.createClass. ' +
182
- 'Use a static property to define defaultProps instead.',
183
- this.getName() || 'a component'
184
- ) : null);
185
- ("production" !== process.env.NODE_ENV ? warning(
186
- !inst.propTypes,
187
- 'propTypes was defined as an instance property on %s. Use a static ' +
188
- 'property to define propTypes instead.',
189
- this.getName() || 'a component'
190
- ) : null);
191
- ("production" !== process.env.NODE_ENV ? warning(
192
- !inst.contextTypes,
193
- 'contextTypes was defined as an instance property on %s. Use a ' +
194
- 'static property to define contextTypes instead.',
195
- this.getName() || 'a component'
196
- ) : null);
197
- ("production" !== process.env.NODE_ENV ? warning(
198
- typeof inst.componentShouldUpdate !== 'function',
199
- '%s has a method called ' +
200
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
201
- 'The name is phrased as a question because the function is ' +
202
- 'expected to return a value.',
203
- (this.getName() || 'A component')
204
- ) : null);
156
+ 'production' !== process.env.NODE_ENV ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : null;
157
+ 'production' !== process.env.NODE_ENV ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : null;
158
+ 'production' !== process.env.NODE_ENV ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : null;
159
+ 'production' !== process.env.NODE_ENV ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : null;
160
+ 'production' !== process.env.NODE_ENV ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : null;
205
161
  }
206
162
 
207
163
  var initialState = inst.state;
208
164
  if (initialState === undefined) {
209
165
  inst.state = initialState = null;
210
166
  }
211
- ("production" !== process.env.NODE_ENV ? invariant(
212
- typeof initialState === 'object' && !Array.isArray(initialState),
213
- '%s.state: must be set to an object or null',
214
- this.getName() || 'ReactCompositeComponent'
215
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
167
+ 'production' !== process.env.NODE_ENV ? invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(typeof initialState === 'object' && !Array.isArray(initialState));
216
168
 
217
169
  this._pendingStateQueue = null;
218
170
  this._pendingReplaceState = false;
219
171
  this._pendingForceUpdate = false;
220
172
 
221
- var childContext;
222
173
  var renderedElement;
223
174
 
224
175
  var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
@@ -233,23 +184,15 @@ var ReactCompositeComponentMixin = {
233
184
  }
234
185
  }
235
186
 
236
- childContext = this._getValidatedChildContext(context);
237
- renderedElement = this._renderValidatedComponent(childContext);
187
+ renderedElement = this._renderValidatedComponent();
238
188
  } finally {
239
189
  ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
240
190
  }
241
191
 
242
- this._renderedComponent = this._instantiateReactComponent(
243
- renderedElement,
244
- this._currentElement.type // The wrapping type
192
+ this._renderedComponent = this._instantiateReactComponent(renderedElement, this._currentElement.type // The wrapping type
245
193
  );
246
194
 
247
- var markup = ReactReconciler.mountComponent(
248
- this._renderedComponent,
249
- rootID,
250
- transaction,
251
- this._mergeChildContext(context, childContext)
252
- );
195
+ var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
253
196
  if (inst.componentDidMount) {
254
197
  transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
255
198
  }
@@ -263,7 +206,7 @@ var ReactCompositeComponentMixin = {
263
206
  * @final
264
207
  * @internal
265
208
  */
266
- unmountComponent: function() {
209
+ unmountComponent: function () {
267
210
  var inst = this._instance;
268
211
 
269
212
  if (inst.componentWillUnmount) {
@@ -311,14 +254,11 @@ var ReactCompositeComponentMixin = {
311
254
  * @final
312
255
  * @internal
313
256
  */
314
- _setPropsInternal: function(partialProps, callback) {
257
+ _setPropsInternal: function (partialProps, callback) {
315
258
  // This is a deoptimized path. We optimize for always having an element.
316
259
  // This creates an extra internal element.
317
260
  var element = this._pendingElement || this._currentElement;
318
- this._pendingElement = ReactElement.cloneAndReplaceProps(
319
- element,
320
- assign({}, element.props, partialProps)
321
- );
261
+ this._pendingElement = ReactElement.cloneAndReplaceProps(element, assign({}, element.props, partialProps));
322
262
  ReactUpdates.enqueueUpdate(this, callback);
323
263
  },
324
264
 
@@ -330,7 +270,7 @@ var ReactCompositeComponentMixin = {
330
270
  * @return {?object}
331
271
  * @private
332
272
  */
333
- _maskContext: function(context) {
273
+ _maskContext: function (context) {
334
274
  var maskedContext = null;
335
275
  // This really should be getting the component class for the element,
336
276
  // but we know that we're not going to need it for built-ins.
@@ -356,18 +296,12 @@ var ReactCompositeComponentMixin = {
356
296
  * @return {?object}
357
297
  * @private
358
298
  */
359
- _processContext: function(context) {
299
+ _processContext: function (context) {
360
300
  var maskedContext = this._maskContext(context);
361
- if ("production" !== process.env.NODE_ENV) {
362
- var Component = ReactNativeComponent.getComponentClassForElement(
363
- this._currentElement
364
- );
301
+ if ('production' !== process.env.NODE_ENV) {
302
+ var Component = ReactNativeComponent.getComponentClassForElement(this._currentElement);
365
303
  if (Component.contextTypes) {
366
- this._checkPropTypes(
367
- Component.contextTypes,
368
- maskedContext,
369
- ReactPropTypeLocations.context
370
- );
304
+ this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
371
305
  }
372
306
  }
373
307
  return maskedContext;
@@ -378,38 +312,17 @@ var ReactCompositeComponentMixin = {
378
312
  * @return {object}
379
313
  * @private
380
314
  */
381
- _getValidatedChildContext: function(currentContext) {
315
+ _processChildContext: function (currentContext) {
382
316
  var inst = this._instance;
383
317
  var childContext = inst.getChildContext && inst.getChildContext();
384
318
  if (childContext) {
385
- ("production" !== process.env.NODE_ENV ? invariant(
386
- typeof inst.constructor.childContextTypes === 'object',
387
- '%s.getChildContext(): childContextTypes must be defined in order to ' +
388
- 'use getChildContext().',
389
- this.getName() || 'ReactCompositeComponent'
390
- ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
391
- if ("production" !== process.env.NODE_ENV) {
392
- this._checkPropTypes(
393
- inst.constructor.childContextTypes,
394
- childContext,
395
- ReactPropTypeLocations.childContext
396
- );
319
+ 'production' !== process.env.NODE_ENV ? invariant(typeof inst.constructor.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(typeof inst.constructor.childContextTypes === 'object');
320
+ if ('production' !== process.env.NODE_ENV) {
321
+ this._checkPropTypes(inst.constructor.childContextTypes, childContext, ReactPropTypeLocations.childContext);
397
322
  }
398
323
  for (var name in childContext) {
399
- ("production" !== process.env.NODE_ENV ? invariant(
400
- name in inst.constructor.childContextTypes,
401
- '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
402
- this.getName() || 'ReactCompositeComponent',
403
- name
404
- ) : invariant(name in inst.constructor.childContextTypes));
324
+ 'production' !== process.env.NODE_ENV ? invariant(name in inst.constructor.childContextTypes, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(name in inst.constructor.childContextTypes);
405
325
  }
406
- return childContext;
407
- }
408
- return null;
409
- },
410
-
411
- _mergeChildContext: function(currentContext, childContext) {
412
- if (childContext) {
413
326
  return assign({}, currentContext, childContext);
414
327
  }
415
328
  return currentContext;
@@ -424,17 +337,11 @@ var ReactCompositeComponentMixin = {
424
337
  * @return {object}
425
338
  * @private
426
339
  */
427
- _processProps: function(newProps) {
428
- if ("production" !== process.env.NODE_ENV) {
429
- var Component = ReactNativeComponent.getComponentClassForElement(
430
- this._currentElement
431
- );
340
+ _processProps: function (newProps) {
341
+ if ('production' !== process.env.NODE_ENV) {
342
+ var Component = ReactNativeComponent.getComponentClassForElement(this._currentElement);
432
343
  if (Component.propTypes) {
433
- this._checkPropTypes(
434
- Component.propTypes,
435
- newProps,
436
- ReactPropTypeLocations.prop
437
- );
344
+ this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
438
345
  }
439
346
  }
440
347
  return newProps;
@@ -448,7 +355,7 @@ var ReactCompositeComponentMixin = {
448
355
  * @param {string} location e.g. "prop", "context", "child context"
449
356
  * @private
450
357
  */
451
- _checkPropTypes: function(propTypes, props, location) {
358
+ _checkPropTypes: function (propTypes, props, location) {
452
359
  // TODO: Stop validating prop types here and only use the element
453
360
  // validation.
454
361
  var componentName = this.getName();
@@ -458,14 +365,7 @@ var ReactCompositeComponentMixin = {
458
365
  try {
459
366
  // This is intentionally an invariant that gets caught. It's the same
460
367
  // behavior as without this statement except with a better message.
461
- ("production" !== process.env.NODE_ENV ? invariant(
462
- typeof propTypes[propName] === 'function',
463
- '%s: %s type `%s` is invalid; it must be a function, usually ' +
464
- 'from React.PropTypes.',
465
- componentName || 'React class',
466
- ReactPropTypeLocationNames[location],
467
- propName
468
- ) : invariant(typeof propTypes[propName] === 'function'));
368
+ 'production' !== process.env.NODE_ENV ? invariant(typeof propTypes[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(typeof propTypes[propName] === 'function');
469
369
  error = propTypes[propName](props, propName, componentName, location);
470
370
  } catch (ex) {
471
371
  error = ex;
@@ -478,38 +378,22 @@ var ReactCompositeComponentMixin = {
478
378
 
479
379
  if (location === ReactPropTypeLocations.prop) {
480
380
  // Preface gives us something to blacklist in warning module
481
- ("production" !== process.env.NODE_ENV ? warning(
482
- false,
483
- 'Failed Composite propType: %s%s',
484
- error.message,
485
- addendum
486
- ) : null);
381
+ 'production' !== process.env.NODE_ENV ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : null;
487
382
  } else {
488
- ("production" !== process.env.NODE_ENV ? warning(
489
- false,
490
- 'Failed Context Types: %s%s',
491
- error.message,
492
- addendum
493
- ) : null);
383
+ 'production' !== process.env.NODE_ENV ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : null;
494
384
  }
495
385
  }
496
386
  }
497
387
  }
498
388
  },
499
389
 
500
- receiveComponent: function(nextElement, transaction, nextContext) {
390
+ receiveComponent: function (nextElement, transaction, nextContext) {
501
391
  var prevElement = this._currentElement;
502
392
  var prevContext = this._context;
503
393
 
504
394
  this._pendingElement = null;
505
395
 
506
- this.updateComponent(
507
- transaction,
508
- prevElement,
509
- nextElement,
510
- prevContext,
511
- nextContext
512
- );
396
+ this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
513
397
  },
514
398
 
515
399
  /**
@@ -519,54 +403,17 @@ var ReactCompositeComponentMixin = {
519
403
  * @param {ReactReconcileTransaction} transaction
520
404
  * @internal
521
405
  */
522
- performUpdateIfNecessary: function(transaction) {
406
+ performUpdateIfNecessary: function (transaction) {
523
407
  if (this._pendingElement != null) {
524
- ReactReconciler.receiveComponent(
525
- this,
526
- this._pendingElement || this._currentElement,
527
- transaction,
528
- this._context
529
- );
408
+ ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
530
409
  }
531
410
 
532
411
  if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
533
- if ("production" !== process.env.NODE_ENV) {
534
- ReactElementValidator.checkAndWarnForMutatedProps(
535
- this._currentElement
536
- );
412
+ if ('production' !== process.env.NODE_ENV) {
413
+ ReactElementValidator.checkAndWarnForMutatedProps(this._currentElement);
537
414
  }
538
415
 
539
- this.updateComponent(
540
- transaction,
541
- this._currentElement,
542
- this._currentElement,
543
- this._context,
544
- this._context
545
- );
546
- }
547
- },
548
-
549
- /**
550
- * Compare two contexts, warning if they are different
551
- * TODO: Remove this check when owner-context is removed
552
- */
553
- _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
554
- ownerBasedContext = this._maskContext(ownerBasedContext);
555
- parentBasedContext = this._maskContext(parentBasedContext);
556
- var parentKeys = Object.keys(parentBasedContext).sort();
557
- var displayName = this.getName() || 'ReactCompositeComponent';
558
- for (var i = 0; i < parentKeys.length; i++) {
559
- var key = parentKeys[i];
560
- ("production" !== process.env.NODE_ENV ? warning(
561
- ownerBasedContext[key] === parentBasedContext[key],
562
- 'owner-based and parent-based contexts differ ' +
563
- '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
564
- '(see: http://fb.me/react-context-by-parent)',
565
- ownerBasedContext[key],
566
- parentBasedContext[key],
567
- key,
568
- displayName
569
- ) : null);
416
+ this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
570
417
  }
571
418
  },
572
419
 
@@ -585,13 +432,7 @@ var ReactCompositeComponentMixin = {
585
432
  * @internal
586
433
  * @overridable
587
434
  */
588
- updateComponent: function(
589
- transaction,
590
- prevParentElement,
591
- nextParentElement,
592
- prevUnmaskedContext,
593
- nextUnmaskedContext
594
- ) {
435
+ updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
595
436
  var inst = this._instance;
596
437
 
597
438
  var nextContext = inst.context;
@@ -599,18 +440,9 @@ var ReactCompositeComponentMixin = {
599
440
 
600
441
  // Distinguish between a props update versus a simple state update
601
442
  if (prevParentElement !== nextParentElement) {
602
- nextContext = this._processContext(nextParentElement._context);
443
+ nextContext = this._processContext(nextUnmaskedContext);
603
444
  nextProps = this._processProps(nextParentElement.props);
604
445
 
605
- if ("production" !== process.env.NODE_ENV) {
606
- if (nextUnmaskedContext != null) {
607
- this._warnIfContextsDiffer(
608
- nextParentElement._context,
609
- nextUnmaskedContext
610
- );
611
- }
612
- }
613
-
614
446
  // An update here will schedule an update but immediately set
615
447
  // _pendingStateQueue which will ensure that any state updates gets
616
448
  // immediately reconciled instead of waiting for the next batch.
@@ -622,31 +454,16 @@ var ReactCompositeComponentMixin = {
622
454
 
623
455
  var nextState = this._processPendingState(nextProps, nextContext);
624
456
 
625
- var shouldUpdate =
626
- this._pendingForceUpdate ||
627
- !inst.shouldComponentUpdate ||
628
- inst.shouldComponentUpdate(nextProps, nextState, nextContext);
629
-
630
- if ("production" !== process.env.NODE_ENV) {
631
- ("production" !== process.env.NODE_ENV ? warning(
632
- typeof shouldUpdate !== 'undefined',
633
- '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
634
- 'boolean value. Make sure to return true or false.',
635
- this.getName() || 'ReactCompositeComponent'
636
- ) : null);
457
+ var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
458
+
459
+ if ('production' !== process.env.NODE_ENV) {
460
+ 'production' !== process.env.NODE_ENV ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : null;
637
461
  }
638
462
 
639
463
  if (shouldUpdate) {
640
464
  this._pendingForceUpdate = false;
641
465
  // Will set `this.props`, `this.state` and `this.context`.
642
- this._performComponentUpdate(
643
- nextParentElement,
644
- nextProps,
645
- nextState,
646
- nextContext,
647
- transaction,
648
- nextUnmaskedContext
649
- );
466
+ this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
650
467
  } else {
651
468
  // If it's determined that a component should not update, we still want
652
469
  // to set props and state but we shortcut the rest of the update.
@@ -658,7 +475,7 @@ var ReactCompositeComponentMixin = {
658
475
  }
659
476
  },
660
477
 
661
- _processPendingState: function(props, context) {
478
+ _processPendingState: function (props, context) {
662
479
  var inst = this._instance;
663
480
  var queue = this._pendingStateQueue;
664
481
  var replace = this._pendingReplaceState;
@@ -676,12 +493,7 @@ var ReactCompositeComponentMixin = {
676
493
  var nextState = assign({}, replace ? queue[0] : inst.state);
677
494
  for (var i = replace ? 1 : 0; i < queue.length; i++) {
678
495
  var partial = queue[i];
679
- assign(
680
- nextState,
681
- typeof partial === 'function' ?
682
- partial.call(inst, nextState, props, context) :
683
- partial
684
- );
496
+ assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
685
497
  }
686
498
 
687
499
  return nextState;
@@ -699,14 +511,7 @@ var ReactCompositeComponentMixin = {
699
511
  * @param {?object} unmaskedContext
700
512
  * @private
701
513
  */
702
- _performComponentUpdate: function(
703
- nextElement,
704
- nextProps,
705
- nextState,
706
- nextContext,
707
- transaction,
708
- unmaskedContext
709
- ) {
514
+ _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
710
515
  var inst = this._instance;
711
516
 
712
517
  var prevProps = inst.props;
@@ -726,10 +531,7 @@ var ReactCompositeComponentMixin = {
726
531
  this._updateRenderedComponent(transaction, unmaskedContext);
727
532
 
728
533
  if (inst.componentDidUpdate) {
729
- transaction.getReactMountReady().enqueue(
730
- inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
731
- inst
732
- );
534
+ transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
733
535
  }
734
536
  },
735
537
 
@@ -739,34 +541,20 @@ var ReactCompositeComponentMixin = {
739
541
  * @param {ReactReconcileTransaction} transaction
740
542
  * @internal
741
543
  */
742
- _updateRenderedComponent: function(transaction, context) {
544
+ _updateRenderedComponent: function (transaction, context) {
743
545
  var prevComponentInstance = this._renderedComponent;
744
546
  var prevRenderedElement = prevComponentInstance._currentElement;
745
- var childContext = this._getValidatedChildContext();
746
- var nextRenderedElement = this._renderValidatedComponent(childContext);
547
+ var nextRenderedElement = this._renderValidatedComponent();
747
548
  if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
748
- ReactReconciler.receiveComponent(
749
- prevComponentInstance,
750
- nextRenderedElement,
751
- transaction,
752
- this._mergeChildContext(context, childContext)
753
- );
549
+ ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
754
550
  } else {
755
551
  // These two IDs are actually the same! But nothing should rely on that.
756
552
  var thisID = this._rootNodeID;
757
553
  var prevComponentID = prevComponentInstance._rootNodeID;
758
554
  ReactReconciler.unmountComponent(prevComponentInstance);
759
555
 
760
- this._renderedComponent = this._instantiateReactComponent(
761
- nextRenderedElement,
762
- this._currentElement.type
763
- );
764
- var nextMarkup = ReactReconciler.mountComponent(
765
- this._renderedComponent,
766
- thisID,
767
- transaction,
768
- this._mergeChildContext(context, childContext)
769
- );
556
+ this._renderedComponent = this._instantiateReactComponent(nextRenderedElement, this._currentElement.type);
557
+ var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
770
558
  this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
771
559
  }
772
560
  },
@@ -774,23 +562,19 @@ var ReactCompositeComponentMixin = {
774
562
  /**
775
563
  * @protected
776
564
  */
777
- _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
778
- ReactComponentEnvironment.replaceNodeWithMarkupByID(
779
- prevComponentID,
780
- nextMarkup
781
- );
565
+ _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
566
+ ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
782
567
  },
783
568
 
784
569
  /**
785
570
  * @protected
786
571
  */
787
- _renderValidatedComponentWithoutOwnerOrContext: function() {
572
+ _renderValidatedComponentWithoutOwnerOrContext: function () {
788
573
  var inst = this._instance;
789
574
  var renderedComponent = inst.render();
790
- if ("production" !== process.env.NODE_ENV) {
575
+ if ('production' !== process.env.NODE_ENV) {
791
576
  // We allow auto-mocks to proceed as if they're returning null.
792
- if (typeof renderedComponent === 'undefined' &&
793
- inst.render._isMockFunction) {
577
+ if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
794
578
  // This is probably bad practice. Consider warning here and
795
579
  // deprecating this convenience.
796
580
  renderedComponent = null;
@@ -803,31 +587,20 @@ var ReactCompositeComponentMixin = {
803
587
  /**
804
588
  * @private
805
589
  */
806
- _renderValidatedComponent: function(childContext) {
590
+ _renderValidatedComponent: function () {
807
591
  var renderedComponent;
808
592
  var previousContext = ReactContext.current;
809
- ReactContext.current = this._mergeChildContext(
810
- this._currentElement._context,
811
- childContext
812
- );
593
+ ReactContext.current = this._processChildContext(this._currentElement._context);
813
594
  ReactCurrentOwner.current = this;
814
595
  try {
815
- renderedComponent =
816
- this._renderValidatedComponentWithoutOwnerOrContext();
596
+ renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
817
597
  } finally {
818
598
  ReactContext.current = previousContext;
819
599
  ReactCurrentOwner.current = null;
820
600
  }
821
- ("production" !== process.env.NODE_ENV ? invariant(
822
- // TODO: An `isValidNode` function would probably be more appropriate
823
- renderedComponent === null || renderedComponent === false ||
824
- ReactElement.isValidElement(renderedComponent),
825
- '%s.render(): A valid ReactComponent must be returned. You may have ' +
826
- 'returned undefined, an array or some other invalid object.',
827
- this.getName() || 'ReactCompositeComponent'
828
- ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
829
- renderedComponent === null || renderedComponent === false ||
830
- ReactElement.isValidElement(renderedComponent)));
601
+ 'production' !== process.env.NODE_ENV ? invariant(
602
+ // TODO: An `isValidNode` function would probably be more appropriate
603
+ renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent), '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent));
831
604
  return renderedComponent;
832
605
  },
833
606
 
@@ -839,9 +612,9 @@ var ReactCompositeComponentMixin = {
839
612
  * @final
840
613
  * @private
841
614
  */
842
- attachRef: function(ref, component) {
615
+ attachRef: function (ref, component) {
843
616
  var inst = this.getPublicInstance();
844
- var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
617
+ var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
845
618
  refs[ref] = component.getPublicInstance();
846
619
  },
847
620
 
@@ -852,7 +625,7 @@ var ReactCompositeComponentMixin = {
852
625
  * @final
853
626
  * @private
854
627
  */
855
- detachRef: function(ref) {
628
+ detachRef: function (ref) {
856
629
  var refs = this.getPublicInstance().refs;
857
630
  delete refs[ref];
858
631
  },
@@ -863,14 +636,10 @@ var ReactCompositeComponentMixin = {
863
636
  * @return {string} The name or null.
864
637
  * @internal
865
638
  */
866
- getName: function() {
639
+ getName: function () {
867
640
  var type = this._currentElement.type;
868
641
  var constructor = this._instance && this._instance.constructor;
869
- return (
870
- type.displayName || (constructor && constructor.displayName) ||
871
- type.name || (constructor && constructor.name) ||
872
- null
873
- );
642
+ return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
874
643
  },
875
644
 
876
645
  /**
@@ -881,7 +650,7 @@ var ReactCompositeComponentMixin = {
881
650
  * @return {ReactComponent} the public component instance.
882
651
  * @internal
883
652
  */
884
- getPublicInstance: function() {
653
+ getPublicInstance: function () {
885
654
  return this._instance;
886
655
  },
887
656
 
@@ -890,15 +659,11 @@ var ReactCompositeComponentMixin = {
890
659
 
891
660
  };
892
661
 
893
- ReactPerf.measureMethods(
894
- ReactCompositeComponentMixin,
895
- 'ReactCompositeComponent',
896
- {
897
- mountComponent: 'mountComponent',
898
- updateComponent: 'updateComponent',
899
- _renderValidatedComponent: '_renderValidatedComponent'
900
- }
901
- );
662
+ ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
663
+ mountComponent: 'mountComponent',
664
+ updateComponent: 'updateComponent',
665
+ _renderValidatedComponent: '_renderValidatedComponent'
666
+ });
902
667
 
903
668
  var ReactCompositeComponent = {
904
669
 
@@ -906,4 +671,4 @@ var ReactCompositeComponent = {
906
671
 
907
672
  };
908
673
 
909
- module.exports = ReactCompositeComponent;
674
+ module.exports = ReactCompositeComponent;