react 0.13.0 → 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 (194) hide show
  1. package/README.md +1 -1
  2. package/addons.js +7 -0
  3. package/addons/CSSTransitionGroup.js +1 -0
  4. package/addons/LinkedStateMixin.js +1 -0
  5. package/addons/Perf.js +1 -0
  6. package/addons/PureRenderMixin.js +1 -0
  7. package/addons/TestUtils.js +1 -0
  8. package/addons/TransitionGroup.js +1 -0
  9. package/addons/batchedUpdates.js +1 -0
  10. package/addons/cloneWithProps.js +1 -0
  11. package/addons/createFragment.js +1 -0
  12. package/addons/renderSubtreeIntoContainer.js +1 -0
  13. package/addons/shallowCompare.js +1 -0
  14. package/addons/update.js +1 -0
  15. package/dist/JSXTransformer.js +3336 -1671
  16. package/dist/react-with-addons.js +3134 -5113
  17. package/dist/react-with-addons.min.js +6 -6
  18. package/dist/react.js +2812 -4567
  19. package/dist/react.min.js +5 -5
  20. package/lib/AutoFocusMixin.js +4 -3
  21. package/lib/BeforeInputEventPlugin.js +30 -118
  22. package/lib/CSSCore.js +12 -23
  23. package/lib/CSSProperty.js +9 -4
  24. package/lib/CSSPropertyOperations.js +14 -30
  25. package/lib/CallbackQueue.js +7 -10
  26. package/lib/ChangeEventPlugin.js +24 -88
  27. package/lib/ClientReactRootIndex.js +2 -2
  28. package/lib/DOMChildrenOperations.js +13 -33
  29. package/lib/DOMProperty.js +41 -65
  30. package/lib/DOMPropertyOperations.js +30 -51
  31. package/lib/Danger.js +19 -60
  32. package/lib/DefaultEventPluginOrder.js +2 -12
  33. package/lib/EnterLeaveEventPlugin.js +11 -33
  34. package/lib/EventConstants.js +2 -2
  35. package/lib/EventListener.js +11 -13
  36. package/lib/EventPluginHub.js +44 -47
  37. package/lib/EventPluginRegistry.js +18 -74
  38. package/lib/EventPluginUtils.js +27 -38
  39. package/lib/EventPropagators.js +23 -26
  40. package/lib/ExecutionEnvironment.js +4 -8
  41. package/lib/FallbackCompositionState.js +3 -3
  42. package/lib/HTMLDOMPropertyConfig.js +12 -18
  43. package/lib/LinkedStateMixin.js +3 -6
  44. package/lib/LinkedValueUtils.js +34 -64
  45. package/lib/LocalEventTrapMixin.js +9 -16
  46. package/lib/Object.assign.js +1 -1
  47. package/lib/PooledClass.js +8 -11
  48. package/lib/React.js +20 -38
  49. package/lib/ReactBrowserComponentMixin.js +9 -2
  50. package/lib/ReactBrowserEventEmitter.js +26 -82
  51. package/lib/ReactCSSTransitionGroup.js +13 -24
  52. package/lib/ReactCSSTransitionGroupChild.js +18 -28
  53. package/lib/ReactChildReconciler.js +11 -19
  54. package/lib/ReactChildren.js +7 -16
  55. package/lib/ReactClass.js +78 -231
  56. package/lib/ReactComponent.js +17 -33
  57. package/lib/ReactComponentBrowserEnvironment.js +4 -6
  58. package/lib/ReactComponentEnvironment.js +6 -12
  59. package/lib/ReactComponentWithPureRenderMixin.js +4 -5
  60. package/lib/ReactCompositeComponent.js +85 -297
  61. package/lib/ReactContext.js +2 -44
  62. package/lib/ReactCurrentOwner.js +1 -3
  63. package/lib/ReactDOM.js +4 -2
  64. package/lib/ReactDOMButton.js +3 -4
  65. package/lib/ReactDOMComponent.js +185 -146
  66. package/lib/ReactDOMForm.js +3 -3
  67. package/lib/ReactDOMIDOperations.js +11 -20
  68. package/lib/ReactDOMIframe.js +3 -3
  69. package/lib/ReactDOMImg.js +3 -3
  70. package/lib/ReactDOMInput.js +22 -35
  71. package/lib/ReactDOMOption.js +52 -10
  72. package/lib/ReactDOMSelect.js +53 -29
  73. package/lib/ReactDOMSelection.js +5 -20
  74. package/lib/ReactDOMTextComponent.js +17 -18
  75. package/lib/ReactDOMTextarea.js +15 -27
  76. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  77. package/lib/ReactDefaultInjection.js +21 -40
  78. package/lib/ReactDefaultPerf.js +41 -72
  79. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  80. package/lib/ReactElement.js +35 -72
  81. package/lib/ReactElementValidator.js +51 -110
  82. package/lib/ReactEmptyComponent.js +7 -11
  83. package/lib/ReactErrorUtils.js +2 -2
  84. package/lib/ReactEventEmitterMixin.js +3 -12
  85. package/lib/ReactEventListener.js +16 -38
  86. package/lib/ReactFragment.js +23 -54
  87. package/lib/ReactInjection.js +1 -1
  88. package/lib/ReactInputSelection.js +11 -21
  89. package/lib/ReactInstanceHandles.js +27 -57
  90. package/lib/ReactInstanceMap.js +5 -5
  91. package/lib/ReactLifeCycle.js +1 -1
  92. package/lib/ReactLink.js +2 -4
  93. package/lib/ReactMarkupChecksum.js +5 -10
  94. package/lib/ReactMount.js +136 -260
  95. package/lib/ReactMultiChild.js +19 -45
  96. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  97. package/lib/ReactNativeComponent.js +7 -11
  98. package/lib/ReactOwner.js +7 -24
  99. package/lib/ReactPerf.js +8 -12
  100. package/lib/ReactPropTransferer.js +4 -4
  101. package/lib/ReactPropTypeLocationNames.js +2 -2
  102. package/lib/ReactPropTypeLocations.js +1 -1
  103. package/lib/ReactPropTypes.js +13 -46
  104. package/lib/ReactReconcileTransaction.js +9 -34
  105. package/lib/ReactReconciler.js +9 -19
  106. package/lib/ReactRef.js +5 -8
  107. package/lib/ReactRootIndex.js +2 -2
  108. package/lib/ReactServerRendering.js +7 -15
  109. package/lib/ReactServerRenderingTransaction.js +7 -32
  110. package/lib/ReactStateSetters.js +6 -6
  111. package/lib/ReactTestUtils.js +94 -166
  112. package/lib/ReactTransitionChildMapping.js +5 -7
  113. package/lib/ReactTransitionEvents.js +5 -5
  114. package/lib/ReactTransitionGroup.js +30 -52
  115. package/lib/ReactUpdateQueue.js +27 -90
  116. package/lib/ReactUpdates.js +27 -79
  117. package/lib/ReactWithAddons.js +7 -6
  118. package/lib/SVGDOMPropertyConfig.js +41 -2
  119. package/lib/SelectEventPlugin.js +28 -29
  120. package/lib/ServerReactRootIndex.js +2 -2
  121. package/lib/SimpleEventPlugin.js +136 -128
  122. package/lib/SyntheticClipboardEvent.js +3 -7
  123. package/lib/SyntheticCompositionEvent.js +3 -9
  124. package/lib/SyntheticDragEvent.js +1 -1
  125. package/lib/SyntheticEvent.js +8 -10
  126. package/lib/SyntheticFocusEvent.js +1 -1
  127. package/lib/SyntheticInputEvent.js +3 -9
  128. package/lib/SyntheticKeyboardEvent.js +4 -4
  129. package/lib/SyntheticMouseEvent.js +8 -14
  130. package/lib/SyntheticTouchEvent.js +1 -1
  131. package/lib/SyntheticUIEvent.js +3 -3
  132. package/lib/SyntheticWheelEvent.js +11 -15
  133. package/lib/Transaction.js +12 -24
  134. package/lib/ViewportMetrics.js +2 -2
  135. package/lib/accumulateInto.js +2 -5
  136. package/lib/adler32.js +2 -2
  137. package/lib/camelize.js +4 -2
  138. package/lib/camelizeStyleName.js +2 -2
  139. package/lib/cloneWithProps.js +5 -11
  140. package/lib/containsNode.js +29 -16
  141. package/lib/createArrayFromMixed.js +17 -16
  142. package/lib/createFullPageComponent.js +5 -11
  143. package/lib/createNodesFromMarkup.js +6 -8
  144. package/lib/dangerousStyleValue.js +2 -3
  145. package/lib/emptyFunction.js +10 -4
  146. package/lib/emptyObject.js +1 -1
  147. package/lib/escapeTextContentForBrowser.js +1 -1
  148. package/lib/findDOMNode.js +5 -24
  149. package/lib/flattenChildren.js +4 -10
  150. package/lib/focusNode.js +2 -3
  151. package/lib/forEachAccumulated.js +2 -2
  152. package/lib/getActiveElement.js +4 -2
  153. package/lib/getEventCharCode.js +1 -1
  154. package/lib/getEventKey.js +1 -1
  155. package/lib/getEventModifierState.js +1 -1
  156. package/lib/getEventTarget.js +1 -1
  157. package/lib/getIteratorFn.js +2 -4
  158. package/lib/getMarkupWrap.js +7 -5
  159. package/lib/getNodeForCharacterOffset.js +1 -1
  160. package/lib/getTextContentAccessor.js +2 -4
  161. package/lib/getUnboundedScrollPosition.js +1 -1
  162. package/lib/hyphenate.js +3 -1
  163. package/lib/hyphenateStyleName.js +2 -2
  164. package/lib/instantiateReactComponent.js +14 -37
  165. package/lib/invariant.js +8 -12
  166. package/lib/isEventSupported.js +7 -10
  167. package/lib/isNode.js +4 -6
  168. package/lib/isTextInputElement.js +2 -4
  169. package/lib/isTextNode.js +3 -1
  170. package/lib/joinClasses.js +2 -2
  171. package/lib/keyMirror.js +3 -6
  172. package/lib/keyOf.js +4 -3
  173. package/lib/mapObject.js +1 -1
  174. package/lib/memoizeStringOnly.js +2 -2
  175. package/lib/onlyChild.js +2 -5
  176. package/lib/performance.js +2 -5
  177. package/lib/performanceNow.js +3 -1
  178. package/lib/quoteAttributeValueForBrowser.js +1 -1
  179. package/lib/renderSubtreeIntoContainer.js +16 -0
  180. package/lib/setInnerHTML.js +11 -8
  181. package/lib/setTextContent.js +3 -3
  182. package/lib/shallowCompare.js +24 -0
  183. package/lib/shallowEqual.js +17 -11
  184. package/lib/shouldUpdateReactComponent.js +3 -64
  185. package/lib/toArray.js +8 -19
  186. package/lib/traverseAllChildren.js +19 -82
  187. package/lib/update.js +33 -90
  188. package/lib/validateDOMNesting.js +264 -0
  189. package/lib/warning.js +17 -15
  190. package/package.json +3 -3
  191. package/lib/MobileSafariClickEventPlugin.js +0 -56
  192. package/lib/ReactPutListenerQueue.js +0 -54
  193. package/lib/cx.js +0 -52
  194. 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,29 +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: 'getDOMNode',
104
- isMounted: 'isMounted',
105
- replaceProps: 'replaceProps',
106
- replaceState: 'replaceState',
107
- setProps: 'setProps'
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.']
108
96
  };
109
- var defineDeprecationWarning = function(methodName, displayName) {
97
+ var defineDeprecationWarning = function (methodName, info) {
110
98
  try {
111
99
  Object.defineProperty(ReactComponent.prototype, methodName, {
112
- get: function() {
113
- ("production" !== process.env.NODE_ENV ? warning(
114
- false,
115
- '%s(...) is deprecated in plain JavaScript React classes.',
116
- displayName
117
- ) : 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;
118
102
  return undefined;
119
103
  }
120
104
  });
121
- } catch (x) {
122
- // IE will fail on defineProperty (es5-shim/sham too)
123
- }
105
+ } catch (x) {}
124
106
  };
125
107
  for (var fnName in deprecatedAPIs) {
126
108
  if (deprecatedAPIs.hasOwnProperty(fnName)) {
@@ -130,3 +112,5 @@ if ("production" !== process.env.NODE_ENV) {
130
112
  }
131
113
 
132
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,53 +149,22 @@ 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.propTypes,
179
- 'propTypes was defined as an instance property on %s. Use a static ' +
180
- 'property to define propTypes instead.',
181
- this.getName() || 'a component'
182
- ) : null);
183
- ("production" !== process.env.NODE_ENV ? warning(
184
- !inst.contextTypes,
185
- 'contextTypes was defined as an instance property on %s. Use a ' +
186
- 'static property to define contextTypes instead.',
187
- this.getName() || 'a component'
188
- ) : null);
189
- ("production" !== process.env.NODE_ENV ? warning(
190
- typeof inst.componentShouldUpdate !== 'function',
191
- '%s has a method called ' +
192
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
193
- 'The name is phrased as a question because the function is ' +
194
- 'expected to return a value.',
195
- (this.getName() || 'A component')
196
- ) : 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;
197
161
  }
198
162
 
199
163
  var initialState = inst.state;
200
164
  if (initialState === undefined) {
201
165
  inst.state = initialState = null;
202
166
  }
203
- ("production" !== process.env.NODE_ENV ? invariant(
204
- typeof initialState === 'object' && !Array.isArray(initialState),
205
- '%s.state: must be set to an object or null',
206
- this.getName() || 'ReactCompositeComponent'
207
- ) : 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));
208
168
 
209
169
  this._pendingStateQueue = null;
210
170
  this._pendingReplaceState = false;
@@ -229,17 +189,10 @@ var ReactCompositeComponentMixin = {
229
189
  ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
230
190
  }
231
191
 
232
- this._renderedComponent = this._instantiateReactComponent(
233
- renderedElement,
234
- this._currentElement.type // The wrapping type
192
+ this._renderedComponent = this._instantiateReactComponent(renderedElement, this._currentElement.type // The wrapping type
235
193
  );
236
194
 
237
- var markup = ReactReconciler.mountComponent(
238
- this._renderedComponent,
239
- rootID,
240
- transaction,
241
- this._processChildContext(context)
242
- );
195
+ var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
243
196
  if (inst.componentDidMount) {
244
197
  transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
245
198
  }
@@ -253,7 +206,7 @@ var ReactCompositeComponentMixin = {
253
206
  * @final
254
207
  * @internal
255
208
  */
256
- unmountComponent: function() {
209
+ unmountComponent: function () {
257
210
  var inst = this._instance;
258
211
 
259
212
  if (inst.componentWillUnmount) {
@@ -301,14 +254,11 @@ var ReactCompositeComponentMixin = {
301
254
  * @final
302
255
  * @internal
303
256
  */
304
- _setPropsInternal: function(partialProps, callback) {
257
+ _setPropsInternal: function (partialProps, callback) {
305
258
  // This is a deoptimized path. We optimize for always having an element.
306
259
  // This creates an extra internal element.
307
260
  var element = this._pendingElement || this._currentElement;
308
- this._pendingElement = ReactElement.cloneAndReplaceProps(
309
- element,
310
- assign({}, element.props, partialProps)
311
- );
261
+ this._pendingElement = ReactElement.cloneAndReplaceProps(element, assign({}, element.props, partialProps));
312
262
  ReactUpdates.enqueueUpdate(this, callback);
313
263
  },
314
264
 
@@ -320,7 +270,7 @@ var ReactCompositeComponentMixin = {
320
270
  * @return {?object}
321
271
  * @private
322
272
  */
323
- _maskContext: function(context) {
273
+ _maskContext: function (context) {
324
274
  var maskedContext = null;
325
275
  // This really should be getting the component class for the element,
326
276
  // but we know that we're not going to need it for built-ins.
@@ -346,18 +296,12 @@ var ReactCompositeComponentMixin = {
346
296
  * @return {?object}
347
297
  * @private
348
298
  */
349
- _processContext: function(context) {
299
+ _processContext: function (context) {
350
300
  var maskedContext = this._maskContext(context);
351
- if ("production" !== process.env.NODE_ENV) {
352
- var Component = ReactNativeComponent.getComponentClassForElement(
353
- this._currentElement
354
- );
301
+ if ('production' !== process.env.NODE_ENV) {
302
+ var Component = ReactNativeComponent.getComponentClassForElement(this._currentElement);
355
303
  if (Component.contextTypes) {
356
- this._checkPropTypes(
357
- Component.contextTypes,
358
- maskedContext,
359
- ReactPropTypeLocations.context
360
- );
304
+ this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
361
305
  }
362
306
  }
363
307
  return maskedContext;
@@ -368,30 +312,16 @@ var ReactCompositeComponentMixin = {
368
312
  * @return {object}
369
313
  * @private
370
314
  */
371
- _processChildContext: function(currentContext) {
315
+ _processChildContext: function (currentContext) {
372
316
  var inst = this._instance;
373
317
  var childContext = inst.getChildContext && inst.getChildContext();
374
318
  if (childContext) {
375
- ("production" !== process.env.NODE_ENV ? invariant(
376
- typeof inst.constructor.childContextTypes === 'object',
377
- '%s.getChildContext(): childContextTypes must be defined in order to ' +
378
- 'use getChildContext().',
379
- this.getName() || 'ReactCompositeComponent'
380
- ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
381
- if ("production" !== process.env.NODE_ENV) {
382
- this._checkPropTypes(
383
- inst.constructor.childContextTypes,
384
- childContext,
385
- ReactPropTypeLocations.childContext
386
- );
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);
387
322
  }
388
323
  for (var name in childContext) {
389
- ("production" !== process.env.NODE_ENV ? invariant(
390
- name in inst.constructor.childContextTypes,
391
- '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
392
- this.getName() || 'ReactCompositeComponent',
393
- name
394
- ) : 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);
395
325
  }
396
326
  return assign({}, currentContext, childContext);
397
327
  }
@@ -407,17 +337,11 @@ var ReactCompositeComponentMixin = {
407
337
  * @return {object}
408
338
  * @private
409
339
  */
410
- _processProps: function(newProps) {
411
- if ("production" !== process.env.NODE_ENV) {
412
- var Component = ReactNativeComponent.getComponentClassForElement(
413
- this._currentElement
414
- );
340
+ _processProps: function (newProps) {
341
+ if ('production' !== process.env.NODE_ENV) {
342
+ var Component = ReactNativeComponent.getComponentClassForElement(this._currentElement);
415
343
  if (Component.propTypes) {
416
- this._checkPropTypes(
417
- Component.propTypes,
418
- newProps,
419
- ReactPropTypeLocations.prop
420
- );
344
+ this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
421
345
  }
422
346
  }
423
347
  return newProps;
@@ -431,7 +355,7 @@ var ReactCompositeComponentMixin = {
431
355
  * @param {string} location e.g. "prop", "context", "child context"
432
356
  * @private
433
357
  */
434
- _checkPropTypes: function(propTypes, props, location) {
358
+ _checkPropTypes: function (propTypes, props, location) {
435
359
  // TODO: Stop validating prop types here and only use the element
436
360
  // validation.
437
361
  var componentName = this.getName();
@@ -441,14 +365,7 @@ var ReactCompositeComponentMixin = {
441
365
  try {
442
366
  // This is intentionally an invariant that gets caught. It's the same
443
367
  // behavior as without this statement except with a better message.
444
- ("production" !== process.env.NODE_ENV ? invariant(
445
- typeof propTypes[propName] === 'function',
446
- '%s: %s type `%s` is invalid; it must be a function, usually ' +
447
- 'from React.PropTypes.',
448
- componentName || 'React class',
449
- ReactPropTypeLocationNames[location],
450
- propName
451
- ) : 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');
452
369
  error = propTypes[propName](props, propName, componentName, location);
453
370
  } catch (ex) {
454
371
  error = ex;
@@ -461,38 +378,22 @@ var ReactCompositeComponentMixin = {
461
378
 
462
379
  if (location === ReactPropTypeLocations.prop) {
463
380
  // Preface gives us something to blacklist in warning module
464
- ("production" !== process.env.NODE_ENV ? warning(
465
- false,
466
- 'Failed Composite propType: %s%s',
467
- error.message,
468
- addendum
469
- ) : null);
381
+ 'production' !== process.env.NODE_ENV ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : null;
470
382
  } else {
471
- ("production" !== process.env.NODE_ENV ? warning(
472
- false,
473
- 'Failed Context Types: %s%s',
474
- error.message,
475
- addendum
476
- ) : null);
383
+ 'production' !== process.env.NODE_ENV ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : null;
477
384
  }
478
385
  }
479
386
  }
480
387
  }
481
388
  },
482
389
 
483
- receiveComponent: function(nextElement, transaction, nextContext) {
390
+ receiveComponent: function (nextElement, transaction, nextContext) {
484
391
  var prevElement = this._currentElement;
485
392
  var prevContext = this._context;
486
393
 
487
394
  this._pendingElement = null;
488
395
 
489
- this.updateComponent(
490
- transaction,
491
- prevElement,
492
- nextElement,
493
- prevContext,
494
- nextContext
495
- );
396
+ this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
496
397
  },
497
398
 
498
399
  /**
@@ -502,54 +403,17 @@ var ReactCompositeComponentMixin = {
502
403
  * @param {ReactReconcileTransaction} transaction
503
404
  * @internal
504
405
  */
505
- performUpdateIfNecessary: function(transaction) {
406
+ performUpdateIfNecessary: function (transaction) {
506
407
  if (this._pendingElement != null) {
507
- ReactReconciler.receiveComponent(
508
- this,
509
- this._pendingElement || this._currentElement,
510
- transaction,
511
- this._context
512
- );
408
+ ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
513
409
  }
514
410
 
515
411
  if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
516
- if ("production" !== process.env.NODE_ENV) {
517
- ReactElementValidator.checkAndWarnForMutatedProps(
518
- this._currentElement
519
- );
412
+ if ('production' !== process.env.NODE_ENV) {
413
+ ReactElementValidator.checkAndWarnForMutatedProps(this._currentElement);
520
414
  }
521
415
 
522
- this.updateComponent(
523
- transaction,
524
- this._currentElement,
525
- this._currentElement,
526
- this._context,
527
- this._context
528
- );
529
- }
530
- },
531
-
532
- /**
533
- * Compare two contexts, warning if they are different
534
- * TODO: Remove this check when owner-context is removed
535
- */
536
- _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
537
- ownerBasedContext = this._maskContext(ownerBasedContext);
538
- parentBasedContext = this._maskContext(parentBasedContext);
539
- var parentKeys = Object.keys(parentBasedContext).sort();
540
- var displayName = this.getName() || 'ReactCompositeComponent';
541
- for (var i = 0; i < parentKeys.length; i++) {
542
- var key = parentKeys[i];
543
- ("production" !== process.env.NODE_ENV ? warning(
544
- ownerBasedContext[key] === parentBasedContext[key],
545
- 'owner-based and parent-based contexts differ ' +
546
- '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
547
- '(see: http://fb.me/react-context-by-parent)',
548
- ownerBasedContext[key],
549
- parentBasedContext[key],
550
- key,
551
- displayName
552
- ) : null);
416
+ this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
553
417
  }
554
418
  },
555
419
 
@@ -568,13 +432,7 @@ var ReactCompositeComponentMixin = {
568
432
  * @internal
569
433
  * @overridable
570
434
  */
571
- updateComponent: function(
572
- transaction,
573
- prevParentElement,
574
- nextParentElement,
575
- prevUnmaskedContext,
576
- nextUnmaskedContext
577
- ) {
435
+ updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
578
436
  var inst = this._instance;
579
437
 
580
438
  var nextContext = inst.context;
@@ -582,18 +440,9 @@ var ReactCompositeComponentMixin = {
582
440
 
583
441
  // Distinguish between a props update versus a simple state update
584
442
  if (prevParentElement !== nextParentElement) {
585
- nextContext = this._processContext(nextParentElement._context);
443
+ nextContext = this._processContext(nextUnmaskedContext);
586
444
  nextProps = this._processProps(nextParentElement.props);
587
445
 
588
- if ("production" !== process.env.NODE_ENV) {
589
- if (nextUnmaskedContext != null) {
590
- this._warnIfContextsDiffer(
591
- nextParentElement._context,
592
- nextUnmaskedContext
593
- );
594
- }
595
- }
596
-
597
446
  // An update here will schedule an update but immediately set
598
447
  // _pendingStateQueue which will ensure that any state updates gets
599
448
  // immediately reconciled instead of waiting for the next batch.
@@ -605,31 +454,16 @@ var ReactCompositeComponentMixin = {
605
454
 
606
455
  var nextState = this._processPendingState(nextProps, nextContext);
607
456
 
608
- var shouldUpdate =
609
- this._pendingForceUpdate ||
610
- !inst.shouldComponentUpdate ||
611
- inst.shouldComponentUpdate(nextProps, nextState, nextContext);
612
-
613
- if ("production" !== process.env.NODE_ENV) {
614
- ("production" !== process.env.NODE_ENV ? warning(
615
- typeof shouldUpdate !== 'undefined',
616
- '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
617
- 'boolean value. Make sure to return true or false.',
618
- this.getName() || 'ReactCompositeComponent'
619
- ) : 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;
620
461
  }
621
462
 
622
463
  if (shouldUpdate) {
623
464
  this._pendingForceUpdate = false;
624
465
  // Will set `this.props`, `this.state` and `this.context`.
625
- this._performComponentUpdate(
626
- nextParentElement,
627
- nextProps,
628
- nextState,
629
- nextContext,
630
- transaction,
631
- nextUnmaskedContext
632
- );
466
+ this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
633
467
  } else {
634
468
  // If it's determined that a component should not update, we still want
635
469
  // to set props and state but we shortcut the rest of the update.
@@ -641,7 +475,7 @@ var ReactCompositeComponentMixin = {
641
475
  }
642
476
  },
643
477
 
644
- _processPendingState: function(props, context) {
478
+ _processPendingState: function (props, context) {
645
479
  var inst = this._instance;
646
480
  var queue = this._pendingStateQueue;
647
481
  var replace = this._pendingReplaceState;
@@ -652,15 +486,14 @@ var ReactCompositeComponentMixin = {
652
486
  return inst.state;
653
487
  }
654
488
 
489
+ if (replace && queue.length === 1) {
490
+ return queue[0];
491
+ }
492
+
655
493
  var nextState = assign({}, replace ? queue[0] : inst.state);
656
494
  for (var i = replace ? 1 : 0; i < queue.length; i++) {
657
495
  var partial = queue[i];
658
- assign(
659
- nextState,
660
- typeof partial === 'function' ?
661
- partial.call(inst, nextState, props, context) :
662
- partial
663
- );
496
+ assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
664
497
  }
665
498
 
666
499
  return nextState;
@@ -678,14 +511,7 @@ var ReactCompositeComponentMixin = {
678
511
  * @param {?object} unmaskedContext
679
512
  * @private
680
513
  */
681
- _performComponentUpdate: function(
682
- nextElement,
683
- nextProps,
684
- nextState,
685
- nextContext,
686
- transaction,
687
- unmaskedContext
688
- ) {
514
+ _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
689
515
  var inst = this._instance;
690
516
 
691
517
  var prevProps = inst.props;
@@ -705,10 +531,7 @@ var ReactCompositeComponentMixin = {
705
531
  this._updateRenderedComponent(transaction, unmaskedContext);
706
532
 
707
533
  if (inst.componentDidUpdate) {
708
- transaction.getReactMountReady().enqueue(
709
- inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
710
- inst
711
- );
534
+ transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
712
535
  }
713
536
  },
714
537
 
@@ -718,33 +541,20 @@ var ReactCompositeComponentMixin = {
718
541
  * @param {ReactReconcileTransaction} transaction
719
542
  * @internal
720
543
  */
721
- _updateRenderedComponent: function(transaction, context) {
544
+ _updateRenderedComponent: function (transaction, context) {
722
545
  var prevComponentInstance = this._renderedComponent;
723
546
  var prevRenderedElement = prevComponentInstance._currentElement;
724
547
  var nextRenderedElement = this._renderValidatedComponent();
725
548
  if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
726
- ReactReconciler.receiveComponent(
727
- prevComponentInstance,
728
- nextRenderedElement,
729
- transaction,
730
- this._processChildContext(context)
731
- );
549
+ ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
732
550
  } else {
733
551
  // These two IDs are actually the same! But nothing should rely on that.
734
552
  var thisID = this._rootNodeID;
735
553
  var prevComponentID = prevComponentInstance._rootNodeID;
736
554
  ReactReconciler.unmountComponent(prevComponentInstance);
737
555
 
738
- this._renderedComponent = this._instantiateReactComponent(
739
- nextRenderedElement,
740
- this._currentElement.type
741
- );
742
- var nextMarkup = ReactReconciler.mountComponent(
743
- this._renderedComponent,
744
- thisID,
745
- transaction,
746
- context
747
- );
556
+ this._renderedComponent = this._instantiateReactComponent(nextRenderedElement, this._currentElement.type);
557
+ var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
748
558
  this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
749
559
  }
750
560
  },
@@ -752,23 +562,19 @@ var ReactCompositeComponentMixin = {
752
562
  /**
753
563
  * @protected
754
564
  */
755
- _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
756
- ReactComponentEnvironment.replaceNodeWithMarkupByID(
757
- prevComponentID,
758
- nextMarkup
759
- );
565
+ _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
566
+ ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
760
567
  },
761
568
 
762
569
  /**
763
570
  * @protected
764
571
  */
765
- _renderValidatedComponentWithoutOwnerOrContext: function() {
572
+ _renderValidatedComponentWithoutOwnerOrContext: function () {
766
573
  var inst = this._instance;
767
574
  var renderedComponent = inst.render();
768
- if ("production" !== process.env.NODE_ENV) {
575
+ if ('production' !== process.env.NODE_ENV) {
769
576
  // We allow auto-mocks to proceed as if they're returning null.
770
- if (typeof renderedComponent === 'undefined' &&
771
- inst.render._isMockFunction) {
577
+ if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
772
578
  // This is probably bad practice. Consider warning here and
773
579
  // deprecating this convenience.
774
580
  renderedComponent = null;
@@ -781,30 +587,20 @@ var ReactCompositeComponentMixin = {
781
587
  /**
782
588
  * @private
783
589
  */
784
- _renderValidatedComponent: function() {
590
+ _renderValidatedComponent: function () {
785
591
  var renderedComponent;
786
592
  var previousContext = ReactContext.current;
787
- ReactContext.current = this._processChildContext(
788
- this._currentElement._context
789
- );
593
+ ReactContext.current = this._processChildContext(this._currentElement._context);
790
594
  ReactCurrentOwner.current = this;
791
595
  try {
792
- renderedComponent =
793
- this._renderValidatedComponentWithoutOwnerOrContext();
596
+ renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
794
597
  } finally {
795
598
  ReactContext.current = previousContext;
796
599
  ReactCurrentOwner.current = null;
797
600
  }
798
- ("production" !== process.env.NODE_ENV ? invariant(
799
- // TODO: An `isValidNode` function would probably be more appropriate
800
- renderedComponent === null || renderedComponent === false ||
801
- ReactElement.isValidElement(renderedComponent),
802
- '%s.render(): A valid ReactComponent must be returned. You may have ' +
803
- 'returned undefined, an array or some other invalid object.',
804
- this.getName() || 'ReactCompositeComponent'
805
- ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
806
- renderedComponent === null || renderedComponent === false ||
807
- 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));
808
604
  return renderedComponent;
809
605
  },
810
606
 
@@ -816,9 +612,9 @@ var ReactCompositeComponentMixin = {
816
612
  * @final
817
613
  * @private
818
614
  */
819
- attachRef: function(ref, component) {
615
+ attachRef: function (ref, component) {
820
616
  var inst = this.getPublicInstance();
821
- var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
617
+ var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
822
618
  refs[ref] = component.getPublicInstance();
823
619
  },
824
620
 
@@ -829,7 +625,7 @@ var ReactCompositeComponentMixin = {
829
625
  * @final
830
626
  * @private
831
627
  */
832
- detachRef: function(ref) {
628
+ detachRef: function (ref) {
833
629
  var refs = this.getPublicInstance().refs;
834
630
  delete refs[ref];
835
631
  },
@@ -840,14 +636,10 @@ var ReactCompositeComponentMixin = {
840
636
  * @return {string} The name or null.
841
637
  * @internal
842
638
  */
843
- getName: function() {
639
+ getName: function () {
844
640
  var type = this._currentElement.type;
845
641
  var constructor = this._instance && this._instance.constructor;
846
- return (
847
- type.displayName || (constructor && constructor.displayName) ||
848
- type.name || (constructor && constructor.name) ||
849
- null
850
- );
642
+ return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
851
643
  },
852
644
 
853
645
  /**
@@ -858,7 +650,7 @@ var ReactCompositeComponentMixin = {
858
650
  * @return {ReactComponent} the public component instance.
859
651
  * @internal
860
652
  */
861
- getPublicInstance: function() {
653
+ getPublicInstance: function () {
862
654
  return this._instance;
863
655
  },
864
656
 
@@ -867,15 +659,11 @@ var ReactCompositeComponentMixin = {
867
659
 
868
660
  };
869
661
 
870
- ReactPerf.measureMethods(
871
- ReactCompositeComponentMixin,
872
- 'ReactCompositeComponent',
873
- {
874
- mountComponent: 'mountComponent',
875
- updateComponent: 'updateComponent',
876
- _renderValidatedComponent: '_renderValidatedComponent'
877
- }
878
- );
662
+ ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
663
+ mountComponent: 'mountComponent',
664
+ updateComponent: 'updateComponent',
665
+ _renderValidatedComponent: '_renderValidatedComponent'
666
+ });
879
667
 
880
668
  var ReactCompositeComponent = {
881
669
 
@@ -883,4 +671,4 @@ var ReactCompositeComponent = {
883
671
 
884
672
  };
885
673
 
886
- module.exports = ReactCompositeComponent;
674
+ module.exports = ReactCompositeComponent;