react 0.14.0-alpha3 → 0.14.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +5 -2
  2. package/addons.js +2 -2
  3. package/dist/JSXTransformer.js +69 -70
  4. package/dist/react-with-addons.js +2047 -2078
  5. package/dist/react-with-addons.min.js +6 -6
  6. package/dist/react.js +1861 -1904
  7. package/dist/react.min.js +5 -5
  8. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +13 -3
  9. package/lib/ChangeEventPlugin.js +4 -2
  10. package/lib/DOMProperty.js +81 -116
  11. package/lib/DOMPropertyOperations.js +70 -25
  12. package/lib/EnterLeaveEventPlugin.js +3 -3
  13. package/lib/EventPluginHub.js +2 -2
  14. package/lib/EventPluginUtils.js +6 -6
  15. package/lib/HTMLDOMPropertyConfig.js +8 -1
  16. package/lib/LinkedValueUtils.js +45 -33
  17. package/lib/PooledClass.js +12 -0
  18. package/lib/React.js +1 -1
  19. package/lib/ReactCSSTransitionGroupChild.js +8 -0
  20. package/lib/ReactChildren.js +3 -3
  21. package/lib/ReactClass.js +29 -47
  22. package/lib/ReactComponent.js +11 -6
  23. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  24. package/lib/ReactCompositeComponent.js +45 -72
  25. package/lib/ReactDOM.js +1 -0
  26. package/lib/ReactDOMButton.js +15 -26
  27. package/lib/ReactDOMClient.js +9 -4
  28. package/lib/ReactDOMComponent.js +302 -24
  29. package/lib/ReactDOMIDOperations.js +14 -0
  30. package/lib/ReactDOMInput.js +78 -94
  31. package/lib/ReactDOMOption.js +19 -38
  32. package/lib/ReactDOMSelect.js +85 -95
  33. package/lib/ReactDOMTextarea.js +39 -52
  34. package/lib/ReactDefaultInjection.js +0 -47
  35. package/lib/ReactElement.js +18 -79
  36. package/lib/ReactElementValidator.js +29 -98
  37. package/lib/ReactErrorUtils.js +1 -1
  38. package/lib/ReactEventEmitterMixin.js +2 -3
  39. package/lib/ReactEventListener.js +43 -3
  40. package/lib/ReactFragment.js +12 -7
  41. package/lib/ReactInputSelection.js +4 -3
  42. package/lib/ReactInstanceHandles.js +3 -2
  43. package/lib/ReactMount.js +20 -40
  44. package/lib/ReactNativeComponent.js +0 -5
  45. package/lib/ReactNoopUpdateQueue.js +118 -0
  46. package/lib/ReactPropTypes.js +3 -3
  47. package/lib/ReactReconcileTransaction.js +2 -2
  48. package/lib/ReactReconciler.js +8 -10
  49. package/lib/ReactServerBatchingStrategy.js +23 -0
  50. package/lib/ReactServerRendering.js +13 -0
  51. package/lib/ReactServerRenderingTransaction.js +2 -2
  52. package/lib/ReactTestUtils.js +56 -33
  53. package/lib/ReactUpdateQueue.js +51 -26
  54. package/lib/ReactUpdates.js +0 -3
  55. package/lib/ReactWithAddons.js +0 -2
  56. package/lib/SelectEventPlugin.js +6 -7
  57. package/lib/SimpleEventPlugin.js +4 -4
  58. package/lib/SyntheticClipboardEvent.js +2 -2
  59. package/lib/SyntheticCompositionEvent.js +2 -2
  60. package/lib/SyntheticDragEvent.js +2 -2
  61. package/lib/SyntheticEvent.js +6 -5
  62. package/lib/SyntheticFocusEvent.js +2 -2
  63. package/lib/SyntheticInputEvent.js +2 -2
  64. package/lib/SyntheticKeyboardEvent.js +2 -2
  65. package/lib/SyntheticMouseEvent.js +2 -2
  66. package/lib/SyntheticTouchEvent.js +2 -2
  67. package/lib/SyntheticUIEvent.js +2 -2
  68. package/lib/SyntheticWheelEvent.js +2 -2
  69. package/lib/Transaction.js +10 -4
  70. package/lib/cloneWithProps.js +1 -1
  71. package/lib/deprecated.js +47 -0
  72. package/lib/findDOMNode.js +2 -3
  73. package/lib/forEachAccumulated.js +1 -1
  74. package/lib/getEventCharCode.js +1 -1
  75. package/lib/getEventModifierState.js +0 -1
  76. package/lib/getMarkupWrap.js +13 -35
  77. package/lib/instantiateReactComponent.js +13 -9
  78. package/lib/isTextInputElement.js +2 -1
  79. package/lib/joinClasses.js +1 -1
  80. package/lib/setInnerHTML.js +1 -1
  81. package/lib/traverseAllChildren.js +1 -1
  82. package/lib/warning.js +0 -4
  83. package/package.json +1 -1
  84. package/react.js +53 -1
  85. package/addons/CSSTransitionGroup.js +0 -1
  86. package/addons/LinkedStateMixin.js +0 -1
  87. package/addons/Perf.js +0 -1
  88. package/addons/PureRenderMixin.js +0 -1
  89. package/addons/TestUtils.js +0 -1
  90. package/addons/TransitionGroup.js +0 -1
  91. package/addons/batchedUpdates.js +0 -1
  92. package/addons/cloneWithProps.js +0 -1
  93. package/addons/createFragment.js +0 -1
  94. package/addons/renderSubtreeIntoContainer.js +0 -1
  95. package/addons/shallowCompare.js +0 -1
  96. package/addons/update.js +0 -1
  97. package/lib/LocalEventTrapMixin.js +0 -46
  98. package/lib/ReactContext.js +0 -32
  99. package/lib/ReactDOMForm.js +0 -47
  100. package/lib/ReactDOMIframe.js +0 -43
  101. package/lib/ReactDOMImg.js +0 -44
  102. package/lib/ReactLifeCycle.js +0 -35
  103. package/lib/createFullPageComponent.js +0 -51
@@ -53,7 +53,7 @@ var EnterLeaveEventPlugin = {
53
53
  * @return {*} An accumulation of synthetic events.
54
54
  * @see {EventPluginHub.extractEvents}
55
55
  */
56
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
56
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
57
57
  if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
58
58
  return null;
59
59
  }
@@ -93,12 +93,12 @@ var EnterLeaveEventPlugin = {
93
93
  var fromID = from ? ReactMount.getID(from) : '';
94
94
  var toID = to ? ReactMount.getID(to) : '';
95
95
 
96
- var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent);
96
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
97
97
  leave.type = 'mouseleave';
98
98
  leave.target = from;
99
99
  leave.relatedTarget = to;
100
100
 
101
- var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent);
101
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
102
102
  enter.type = 'mouseenter';
103
103
  enter.target = to;
104
104
  enter.relatedTarget = from;
@@ -212,14 +212,14 @@ var EventPluginHub = {
212
212
  * @return {*} An accumulation of synthetic events.
213
213
  * @internal
214
214
  */
215
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
215
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
216
216
  var events;
217
217
  var plugins = EventPluginRegistry.plugins;
218
218
  for (var i = 0; i < plugins.length; i++) {
219
219
  // Not every plugin in the ordering may be loaded at runtime.
220
220
  var possiblePlugin = plugins[i];
221
221
  if (possiblePlugin) {
222
- var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent);
222
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
223
223
  if (extractedEvents) {
224
224
  events = accumulateInto(events, extractedEvents);
225
225
  }
@@ -88,8 +88,8 @@ function forEachEventDispatch(event, cb) {
88
88
 
89
89
  /**
90
90
  * Default implementation of PluginModule.executeDispatch().
91
- * @param {SyntheticEvent} SyntheticEvent to handle
92
- * @param {function} Application-level callback
91
+ * @param {SyntheticEvent} event SyntheticEvent to handle
92
+ * @param {function} listener Application-level callback
93
93
  * @param {string} domID DOM id to pass to the callback.
94
94
  */
95
95
  function executeDispatch(event, listener, domID) {
@@ -112,8 +112,8 @@ function executeDispatchesInOrder(event, cb) {
112
112
  * Standard/simple iteration through an event's collected dispatches, but stops
113
113
  * at the first dispatch execution returning true, and returns that id.
114
114
  *
115
- * @return id of the first dispatch execution who's listener returns true, or
116
- * null if no listener returned true.
115
+ * @return {?string} id of the first dispatch execution who's listener returns
116
+ * true, or null if no listener returned true.
117
117
  */
118
118
  function executeDispatchesInOrderStopAtTrueImpl(event) {
119
119
  var dispatchListeners = event._dispatchListeners;
@@ -156,7 +156,7 @@ function executeDispatchesInOrderStopAtTrue(event) {
156
156
  * return values at each dispatch execution, but it does tend to make sense when
157
157
  * dealing with "direct" dispatches.
158
158
  *
159
- * @return The return value of executing the single dispatch.
159
+ * @return {*} The return value of executing the single dispatch.
160
160
  */
161
161
  function executeDirectDispatch(event) {
162
162
  if ('production' !== process.env.NODE_ENV) {
@@ -173,7 +173,7 @@ function executeDirectDispatch(event) {
173
173
 
174
174
  /**
175
175
  * @param {SyntheticEvent} event
176
- * @return {bool} True iff number of dispatches accumulated is greater than 0.
176
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
177
177
  */
178
178
  function hasDispatches(event) {
179
179
  return !!event._dispatchListeners;
@@ -43,13 +43,14 @@ var HTMLDOMPropertyConfig = {
43
43
  alt: null,
44
44
  async: HAS_BOOLEAN_VALUE,
45
45
  autoComplete: null,
46
- // autoFocus is polyfilled/normalized by AutoFocusMixin
46
+ // autoFocus is polyfilled/normalized by AutoFocusUtils
47
47
  // autoFocus: HAS_BOOLEAN_VALUE,
48
48
  autoPlay: HAS_BOOLEAN_VALUE,
49
49
  capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
50
50
  cellPadding: null,
51
51
  cellSpacing: null,
52
52
  charSet: MUST_USE_ATTRIBUTE,
53
+ challenge: MUST_USE_ATTRIBUTE,
53
54
  checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
54
55
  classID: MUST_USE_ATTRIBUTE,
55
56
  // To set className on SVG elements, it's necessary to use .setAttribute;
@@ -91,6 +92,9 @@ var HTMLDOMPropertyConfig = {
91
92
  httpEquiv: null,
92
93
  icon: null,
93
94
  id: MUST_USE_PROPERTY,
95
+ is: MUST_USE_ATTRIBUTE,
96
+ keyParams: MUST_USE_ATTRIBUTE,
97
+ keyType: MUST_USE_ATTRIBUTE,
94
98
  label: null,
95
99
  lang: null,
96
100
  list: MUST_USE_ATTRIBUTE,
@@ -168,6 +172,9 @@ var HTMLDOMPropertyConfig = {
168
172
  itemRef: MUST_USE_ATTRIBUTE,
169
173
  // property is supported for OpenGraph in meta tags.
170
174
  property: null,
175
+ // IE-only attribute that specifies security restrictions on an iframe
176
+ // as an alternative to the sandbox attribute on IE<10
177
+ security: MUST_USE_ATTRIBUTE,
171
178
  // IE-only attribute that controls focus behavior
172
179
  unselectable: MUST_USE_ATTRIBUTE
173
180
  },
@@ -13,8 +13,10 @@
13
13
  'use strict';
14
14
 
15
15
  var ReactPropTypes = require("./ReactPropTypes");
16
+ var ReactPropTypeLocations = require("./ReactPropTypeLocations");
16
17
 
17
18
  var invariant = require("./invariant");
19
+ var warning = require("./warning");
18
20
 
19
21
  var hasReadOnlyValue = {
20
22
  'button': true,
@@ -39,20 +41,31 @@ function _assertCheckedLink(inputProps) {
39
41
  !(inputProps.checked == null && inputProps.onChange == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
40
42
  }
41
43
 
42
- /**
43
- * @param {SyntheticEvent} e change event to handle
44
- */
45
- function _handleLinkedValueChange(e) {
46
- /*jshint validthis:true */
47
- this.props.valueLink.requestChange(e.target.value);
48
- }
44
+ var propTypes = {
45
+ value: function (props, propName, componentName) {
46
+ if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
47
+ return null;
48
+ }
49
+ return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
50
+ },
51
+ checked: function (props, propName, componentName) {
52
+ if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
53
+ return null;
54
+ }
55
+ return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
56
+ },
57
+ onChange: ReactPropTypes.func
58
+ };
49
59
 
50
- /**
51
- * @param {SyntheticEvent} e change event to handle
52
- */
53
- function _handleLinkedCheckChange(e) {
54
- /*jshint validthis:true */
55
- this.props.checkedLink.requestChange(e.target.checked);
60
+ var loggedTypeFailures = {};
61
+ function getDeclarationErrorAddendum(owner) {
62
+ if (owner) {
63
+ var name = owner.getName();
64
+ if (name) {
65
+ return ' Check the render method of `' + name + '`.';
66
+ }
67
+ }
68
+ return '';
56
69
  }
57
70
 
58
71
  /**
@@ -60,21 +73,19 @@ function _handleLinkedCheckChange(e) {
60
73
  * this outside of the ReactDOM controlled form components.
61
74
  */
62
75
  var LinkedValueUtils = {
63
- Mixin: {
64
- propTypes: {
65
- value: function (props, propName, componentName) {
66
- if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
67
- return null;
68
- }
69
- return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
70
- },
71
- checked: function (props, propName, componentName) {
72
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
73
- return null;
74
- }
75
- return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
76
- },
77
- onChange: ReactPropTypes.func
76
+ checkPropTypes: function (tagName, props, owner) {
77
+ for (var propName in propTypes) {
78
+ if (propTypes.hasOwnProperty(propName)) {
79
+ var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
80
+ }
81
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
82
+ // Only monitor this failure once because there tends to be a lot of the
83
+ // same error.
84
+ loggedTypeFailures[error.message] = true;
85
+
86
+ var addendum = getDeclarationErrorAddendum(owner);
87
+ 'production' !== process.env.NODE_ENV ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
88
+ }
78
89
  }
79
90
  },
80
91
 
@@ -105,17 +116,18 @@ var LinkedValueUtils = {
105
116
 
106
117
  /**
107
118
  * @param {object} inputProps Props for form component
108
- * @return {function} change callback either from onChange prop or link.
119
+ * @param {SyntheticEvent} event change event to handle
109
120
  */
110
- getOnChange: function (inputProps) {
121
+ executeOnChange: function (inputProps, event) {
111
122
  if (inputProps.valueLink) {
112
123
  _assertValueLink(inputProps);
113
- return _handleLinkedValueChange;
124
+ return inputProps.valueLink.requestChange(event.target.value);
114
125
  } else if (inputProps.checkedLink) {
115
126
  _assertCheckedLink(inputProps);
116
- return _handleLinkedCheckChange;
127
+ return inputProps.checkedLink.requestChange(event.target.checked);
128
+ } else if (inputProps.onChange) {
129
+ return inputProps.onChange.call(undefined, event);
117
130
  }
118
- return inputProps.onChange;
119
131
  }
120
132
  };
121
133
 
@@ -53,6 +53,17 @@ var threeArgumentPooler = function (a1, a2, a3) {
53
53
  }
54
54
  };
55
55
 
56
+ var fourArgumentPooler = function (a1, a2, a3, a4) {
57
+ var Klass = this;
58
+ if (Klass.instancePool.length) {
59
+ var instance = Klass.instancePool.pop();
60
+ Klass.call(instance, a1, a2, a3, a4);
61
+ return instance;
62
+ } else {
63
+ return new Klass(a1, a2, a3, a4);
64
+ }
65
+ };
66
+
56
67
  var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
57
68
  var Klass = this;
58
69
  if (Klass.instancePool.length) {
@@ -103,6 +114,7 @@ var PooledClass = {
103
114
  oneArgumentPooler: oneArgumentPooler,
104
115
  twoArgumentPooler: twoArgumentPooler,
105
116
  threeArgumentPooler: threeArgumentPooler,
117
+ fourArgumentPooler: fourArgumentPooler,
106
118
  fiveArgumentPooler: fiveArgumentPooler
107
119
  };
108
120
 
package/lib/React.js CHANGED
@@ -23,6 +23,6 @@ assign(React, ReactIsomorphic);
23
23
  assign(React, ReactDOMClient);
24
24
  assign(React, ReactDOMServer);
25
25
 
26
- React.version = '0.14.0-alpha3';
26
+ React.version = '0.14.0-beta1';
27
27
 
28
28
  module.exports = React;
@@ -40,6 +40,14 @@ var ReactCSSTransitionGroupChild = React.createClass({
40
40
 
41
41
  transition: function (animationType, finishCallback) {
42
42
  var node = React.findDOMNode(this);
43
+
44
+ if (!node) {
45
+ if (finishCallback) {
46
+ finishCallback();
47
+ }
48
+ return;
49
+ }
50
+
43
51
  var className = this.props.name + '-' + animationType;
44
52
  var activeClassName = className + '-active';
45
53
  var noEventTimeout = null;
@@ -47,7 +47,7 @@ function forEachSingleChild(traverseContext, child, name) {
47
47
  * leaf child.
48
48
  *
49
49
  * @param {?*} children Children tree container.
50
- * @param {function(*, int)} forEachFunc.
50
+ * @param {function(*, int)} forEachFunc
51
51
  * @param {*} forEachContext Context for forEachContext.
52
52
  */
53
53
  function forEachChildren(children, forEachFunc, forEachContext) {
@@ -102,8 +102,8 @@ function mapSingleChildIntoContext(traverseContext, child, name) {
102
102
  * previously relying on the fact that we guarded against null children.
103
103
  *
104
104
  * @param {?*} children Children tree container.
105
- * @param {function(*, int)} mapFunction.
106
- * @param {*} mapContext Context for mapFunction.
105
+ * @param {function(*, int)} func The map function.
106
+ * @param {*} context Context for mapFunction.
107
107
  * @return {object} Object containing the ordered map of results.
108
108
  */
109
109
  function mapChildren(children, func, context) {
package/lib/ReactClass.js CHANGED
@@ -12,16 +12,14 @@
12
12
  'use strict';
13
13
 
14
14
  var ReactComponent = require("./ReactComponent");
15
- var ReactCurrentOwner = require("./ReactCurrentOwner");
16
15
  var ReactElement = require("./ReactElement");
17
16
  var ReactErrorUtils = require("./ReactErrorUtils");
18
- var ReactInstanceMap = require("./ReactInstanceMap");
19
- var ReactLifeCycle = require("./ReactLifeCycle");
20
17
  var ReactPropTypeLocations = require("./ReactPropTypeLocations");
21
18
  var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
22
- var ReactUpdateQueue = require("./ReactUpdateQueue");
19
+ var ReactNoopUpdateQueue = require("./ReactNoopUpdateQueue");
23
20
 
24
21
  var assign = require("./Object.assign");
22
+ var emptyObject = require("./emptyObject");
25
23
  var invariant = require("./invariant");
26
24
  var keyMirror = require("./keyMirror");
27
25
  var keyOf = require("./keyOf");
@@ -56,6 +54,14 @@ var SpecPolicy = keyMirror({
56
54
 
57
55
  var injectedMixins = [];
58
56
 
57
+ var warnedSetProps = false;
58
+ function warnSetProps() {
59
+ if (!warnedSetProps) {
60
+ warnedSetProps = true;
61
+ 'production' !== process.env.NODE_ENV ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call React.render again at the top level.') : undefined;
62
+ }
63
+ }
64
+
59
65
  /**
60
66
  * Composite components are higher-level components that compose other composite
61
67
  * or native components.
@@ -592,18 +598,6 @@ function bindAutoBindMethods(component) {
592
598
  }
593
599
  }
594
600
 
595
- var typeDeprecationDescriptor = {
596
- enumerable: false,
597
- get: function () {
598
- var displayName = this.displayName || this.name || 'Component';
599
- 'production' !== process.env.NODE_ENV ? warning(false, '%s.type is deprecated. Use %s directly to access the class.', displayName, displayName) : undefined;
600
- Object.defineProperty(this, 'type', {
601
- value: this
602
- });
603
- return this;
604
- }
605
- };
606
-
607
601
  /**
608
602
  * Add more to the ReactClass base class. These are all legacy features and
609
603
  * therefore not already part of the modern ReactComponent.
@@ -615,9 +609,9 @@ var ReactClassMixin = {
615
609
  * type signature and the only use case for this, is to avoid that.
616
610
  */
617
611
  replaceState: function (newState, callback) {
618
- ReactUpdateQueue.enqueueReplaceState(this, newState);
612
+ this.updater.enqueueReplaceState(this, newState);
619
613
  if (callback) {
620
- ReactUpdateQueue.enqueueCallback(this, callback);
614
+ this.updater.enqueueCallback(this, callback);
621
615
  }
622
616
  },
623
617
 
@@ -628,19 +622,7 @@ var ReactClassMixin = {
628
622
  * @final
629
623
  */
630
624
  isMounted: function () {
631
- if ('production' !== process.env.NODE_ENV) {
632
- var owner = ReactCurrentOwner.current;
633
- if (owner !== null) {
634
- 'production' !== process.env.NODE_ENV ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
635
- owner._warnedAboutRefsInRender = true;
636
- }
637
- }
638
- var internalInstance = ReactInstanceMap.get(this);
639
- if (internalInstance) {
640
- return internalInstance !== ReactLifeCycle.currentlyMountingInstance;
641
- } else {
642
- return false;
643
- }
625
+ return this.updater.isMounted(this);
644
626
  },
645
627
 
646
628
  /**
@@ -653,9 +635,12 @@ var ReactClassMixin = {
653
635
  * @deprecated
654
636
  */
655
637
  setProps: function (partialProps, callback) {
656
- ReactUpdateQueue.enqueueSetProps(this, partialProps);
638
+ if ('production' !== process.env.NODE_ENV) {
639
+ warnSetProps();
640
+ }
641
+ this.updater.enqueueSetProps(this, partialProps);
657
642
  if (callback) {
658
- ReactUpdateQueue.enqueueCallback(this, callback);
643
+ this.updater.enqueueCallback(this, callback);
659
644
  }
660
645
  },
661
646
 
@@ -669,9 +654,12 @@ var ReactClassMixin = {
669
654
  * @deprecated
670
655
  */
671
656
  replaceProps: function (newProps, callback) {
672
- ReactUpdateQueue.enqueueReplaceProps(this, newProps);
657
+ if ('production' !== process.env.NODE_ENV) {
658
+ warnSetProps();
659
+ }
660
+ this.updater.enqueueReplaceProps(this, newProps);
673
661
  if (callback) {
674
- ReactUpdateQueue.enqueueCallback(this, callback);
662
+ this.updater.enqueueCallback(this, callback);
675
663
  }
676
664
  }
677
665
  };
@@ -694,7 +682,7 @@ var ReactClass = {
694
682
  * @public
695
683
  */
696
684
  createClass: function (spec) {
697
- var Constructor = function (props, context) {
685
+ var Constructor = function (props, context, updater) {
698
686
  // This constructor is overridden by mocks. The argument is used
699
687
  // by mocks to assert on what gets mounted.
700
688
 
@@ -709,6 +697,9 @@ var ReactClass = {
709
697
 
710
698
  this.props = props;
711
699
  this.context = context;
700
+ this.refs = emptyObject;
701
+ this.updater = updater || ReactNoopUpdateQueue;
702
+
712
703
  this.state = null;
713
704
 
714
705
  // ReactClasses doesn't have constructors. Instead, they use the
@@ -756,6 +747,7 @@ var ReactClass = {
756
747
 
757
748
  if ('production' !== process.env.NODE_ENV) {
758
749
  'production' !== process.env.NODE_ENV ? warning(!Constructor.prototype.componentShouldUpdate, '%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.', spec.displayName || 'A component') : undefined;
750
+ 'production' !== process.env.NODE_ENV ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
759
751
  }
760
752
 
761
753
  // Reduce time spent doing lookups by setting these on the prototype.
@@ -765,14 +757,6 @@ var ReactClass = {
765
757
  }
766
758
  }
767
759
 
768
- // Legacy hook
769
- Constructor.type = Constructor;
770
- if ('production' !== process.env.NODE_ENV) {
771
- try {
772
- Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
773
- } catch (x) {}
774
- }
775
-
776
760
  return Constructor;
777
761
  },
778
762
 
@@ -784,6 +768,4 @@ var ReactClass = {
784
768
 
785
769
  };
786
770
 
787
- module.exports = ReactClass;
788
-
789
- // IE will fail on defineProperty (es5-shim/sham too)
771
+ module.exports = ReactClass;