react 0.14.0-alpha2 → 0.14.0-alpha3
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.
- package/dist/JSXTransformer.js +1 -1
- package/dist/react-with-addons.js +223 -207
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +208 -192
- package/dist/react.min.js +5 -5
- package/lib/CSSCore.js +3 -3
- package/lib/CSSPropertyOperations.js +3 -3
- package/lib/CallbackQueue.js +1 -1
- package/lib/DOMChildrenOperations.js +1 -1
- package/lib/DOMProperty.js +4 -4
- package/lib/DOMPropertyOperations.js +1 -1
- package/lib/Danger.js +8 -8
- package/lib/EventPluginHub.js +3 -3
- package/lib/EventPluginRegistry.js +7 -7
- package/lib/EventPluginUtils.js +3 -3
- package/lib/EventPropagators.js +1 -1
- package/lib/HTMLDOMPropertyConfig.js +1 -0
- package/lib/LinkedValueUtils.js +3 -3
- package/lib/LocalEventTrapMixin.js +2 -2
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +1 -1
- package/lib/ReactBrowserComponentMixin.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +1 -1
- package/lib/ReactChildren.js +1 -1
- package/lib/ReactClass.js +18 -18
- package/lib/ReactComponent.js +3 -3
- package/lib/ReactComponentEnvironment.js +1 -1
- package/lib/ReactCompositeComponent.js +17 -21
- package/lib/ReactDOMClient.js +1 -1
- package/lib/ReactDOMComponent.js +9 -9
- package/lib/ReactDOMIDOperations.js +2 -2
- package/lib/ReactDOMInput.js +2 -2
- package/lib/ReactDOMOption.js +3 -4
- package/lib/ReactDOMTextarea.js +4 -4
- package/lib/ReactElement.js +1 -1
- package/lib/ReactElementValidator.js +8 -8
- package/lib/ReactEmptyComponent.js +1 -1
- package/lib/ReactFragment.js +5 -5
- package/lib/ReactInstanceHandles.js +6 -6
- package/lib/ReactMount.js +19 -19
- package/lib/ReactNativeComponent.js +1 -1
- package/lib/ReactOwner.js +2 -2
- package/lib/ReactPropTypes.js +12 -0
- package/lib/ReactServerRendering.js +2 -2
- package/lib/ReactUpdateQueue.js +6 -6
- package/lib/ReactUpdates.js +8 -8
- package/lib/SimpleEventPlugin.js +2 -2
- package/lib/Transaction.js +2 -2
- package/lib/accumulateInto.js +1 -1
- package/lib/cloneWithProps.js +1 -1
- package/lib/createFullPageComponent.js +1 -1
- package/lib/createNodesFromMarkup.js +2 -2
- package/lib/findDOMNode.js +3 -3
- package/lib/flattenChildren.js +1 -1
- package/lib/getMarkupWrap.js +1 -1
- package/lib/instantiateReactComponent.js +3 -3
- package/lib/keyMirror.js +1 -1
- package/lib/onlyChild.js +1 -1
- package/lib/toArray.js +3 -3
- package/lib/traverseAllChildren.js +2 -2
- package/lib/update.js +10 -10
- package/lib/validateDOMNesting.js +10 -2
- package/package.json +1 -1
package/lib/ReactComponent.js
CHANGED
|
@@ -50,9 +50,9 @@ function ReactComponent(props, context) {
|
|
|
50
50
|
* @protected
|
|
51
51
|
*/
|
|
52
52
|
ReactComponent.prototype.setState = function (partialState, callback) {
|
|
53
|
-
|
|
53
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
|
|
54
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().') :
|
|
55
|
+
'production' !== process.env.NODE_ENV ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
|
|
56
56
|
}
|
|
57
57
|
ReactUpdateQueue.enqueueSetState(this, partialState);
|
|
58
58
|
if (callback) {
|
|
@@ -98,7 +98,7 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
98
98
|
try {
|
|
99
99
|
Object.defineProperty(ReactComponent.prototype, methodName, {
|
|
100
100
|
get: function () {
|
|
101
|
-
'production' !== process.env.NODE_ENV ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) :
|
|
101
|
+
'production' !== process.env.NODE_ENV ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
|
|
102
102
|
return undefined;
|
|
103
103
|
}
|
|
104
104
|
});
|
|
@@ -38,7 +38,7 @@ var ReactComponentEnvironment = {
|
|
|
38
38
|
|
|
39
39
|
injection: {
|
|
40
40
|
injectEnvironment: function (environment) {
|
|
41
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
41
|
+
!!injected ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
|
|
42
42
|
ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
|
|
43
43
|
ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
|
|
44
44
|
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
|
|
@@ -135,7 +135,7 @@ var ReactCompositeComponentMixin = {
|
|
|
135
135
|
if ('production' !== process.env.NODE_ENV) {
|
|
136
136
|
// This will throw later in _renderValidatedComponent, but add an early
|
|
137
137
|
// warning now to help debugging
|
|
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') :
|
|
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') : undefined;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// These should be set up in the constructor, but as a convenience for
|
|
@@ -153,18 +153,18 @@ var ReactCompositeComponentMixin = {
|
|
|
153
153
|
// Since plain JS classes are defined without any special initialization
|
|
154
154
|
// logic, we can not catch common errors early. Therefore, we have to
|
|
155
155
|
// catch them here, at initialization time, instead.
|
|
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') :
|
|
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') :
|
|
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') :
|
|
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') :
|
|
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') :
|
|
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') : undefined;
|
|
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') : undefined;
|
|
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') : undefined;
|
|
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') : undefined;
|
|
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') : undefined;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
var initialState = inst.state;
|
|
164
164
|
if (initialState === undefined) {
|
|
165
165
|
inst.state = initialState = null;
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
|
168
168
|
|
|
169
169
|
this._pendingStateQueue = null;
|
|
170
170
|
this._pendingReplaceState = false;
|
|
@@ -272,12 +272,8 @@ var ReactCompositeComponentMixin = {
|
|
|
272
272
|
*/
|
|
273
273
|
_maskContext: function (context) {
|
|
274
274
|
var maskedContext = null;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (typeof this._currentElement.type === 'string') {
|
|
278
|
-
return emptyObject;
|
|
279
|
-
}
|
|
280
|
-
var contextTypes = this._currentElement.type.contextTypes;
|
|
275
|
+
var Component = ReactNativeComponent.getComponentClassForElement(this._currentElement);
|
|
276
|
+
var contextTypes = Component.contextTypes;
|
|
281
277
|
if (!contextTypes) {
|
|
282
278
|
return emptyObject;
|
|
283
279
|
}
|
|
@@ -316,12 +312,12 @@ var ReactCompositeComponentMixin = {
|
|
|
316
312
|
var inst = this._instance;
|
|
317
313
|
var childContext = inst.getChildContext && inst.getChildContext();
|
|
318
314
|
if (childContext) {
|
|
319
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
315
|
+
!(typeof inst.constructor.childContextTypes === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
|
320
316
|
if ('production' !== process.env.NODE_ENV) {
|
|
321
317
|
this._checkPropTypes(inst.constructor.childContextTypes, childContext, ReactPropTypeLocations.childContext);
|
|
322
318
|
}
|
|
323
319
|
for (var name in childContext) {
|
|
324
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
320
|
+
!(name in inst.constructor.childContextTypes) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
|
|
325
321
|
}
|
|
326
322
|
return assign({}, currentContext, childContext);
|
|
327
323
|
}
|
|
@@ -365,7 +361,7 @@ var ReactCompositeComponentMixin = {
|
|
|
365
361
|
try {
|
|
366
362
|
// This is intentionally an invariant that gets caught. It's the same
|
|
367
363
|
// behavior as without this statement except with a better message.
|
|
368
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
364
|
+
!(typeof propTypes[propName] === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
|
|
369
365
|
error = propTypes[propName](props, propName, componentName, location);
|
|
370
366
|
} catch (ex) {
|
|
371
367
|
error = ex;
|
|
@@ -378,9 +374,9 @@ var ReactCompositeComponentMixin = {
|
|
|
378
374
|
|
|
379
375
|
if (location === ReactPropTypeLocations.prop) {
|
|
380
376
|
// Preface gives us something to blacklist in warning module
|
|
381
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) :
|
|
377
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
|
|
382
378
|
} else {
|
|
383
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) :
|
|
379
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
|
|
384
380
|
}
|
|
385
381
|
}
|
|
386
382
|
}
|
|
@@ -457,7 +453,7 @@ var ReactCompositeComponentMixin = {
|
|
|
457
453
|
var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
|
|
458
454
|
|
|
459
455
|
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') :
|
|
456
|
+
'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') : undefined;
|
|
461
457
|
}
|
|
462
458
|
|
|
463
459
|
if (shouldUpdate) {
|
|
@@ -598,9 +594,9 @@ var ReactCompositeComponentMixin = {
|
|
|
598
594
|
ReactContext.current = previousContext;
|
|
599
595
|
ReactCurrentOwner.current = null;
|
|
600
596
|
}
|
|
601
|
-
|
|
597
|
+
!(
|
|
602
598
|
// 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(
|
|
599
|
+
(renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent))) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
|
604
600
|
return renderedComponent;
|
|
605
601
|
},
|
|
606
602
|
|
package/lib/ReactDOMClient.js
CHANGED
|
@@ -64,7 +64,7 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
64
64
|
// information on preventing compatibility mode
|
|
65
65
|
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
|
|
66
66
|
|
|
67
|
-
'production' !== process.env.NODE_ENV ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') :
|
|
67
|
+
'production' !== process.env.NODE_ENV ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
|
|
68
68
|
|
|
69
69
|
var expectedFeatures = [
|
|
70
70
|
// shims
|
package/lib/ReactDOMComponent.js
CHANGED
|
@@ -68,7 +68,7 @@ function checkAndWarnForMutatedStyle(style1, style2, component) {
|
|
|
68
68
|
|
|
69
69
|
styleMutationWarning[hash] = true;
|
|
70
70
|
|
|
71
|
-
'production' !== process.env.NODE_ENV ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', JSON.stringify(style1), JSON.stringify(style2)) :
|
|
71
|
+
'production' !== process.env.NODE_ENV ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', JSON.stringify(style1), JSON.stringify(style2)) : undefined;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
@@ -86,25 +86,25 @@ function assertValidProps(component, props) {
|
|
|
86
86
|
// Note the use of `==` which checks for null or undefined.
|
|
87
87
|
if ('production' !== process.env.NODE_ENV) {
|
|
88
88
|
if (voidElementTags[component._tag]) {
|
|
89
|
-
'production' !== process.env.NODE_ENV ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.', component._tag) :
|
|
89
|
+
'production' !== process.env.NODE_ENV ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.', component._tag) : undefined;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
if (props.dangerouslySetInnerHTML != null) {
|
|
93
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
94
|
-
|
|
93
|
+
!(props.children == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
|
|
94
|
+
!(typeof props.dangerouslySetInnerHTML === 'object' && '__html' in props.dangerouslySetInnerHTML) ? 'production' !== process.env.NODE_ENV ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
|
|
95
95
|
}
|
|
96
96
|
if ('production' !== process.env.NODE_ENV) {
|
|
97
|
-
'production' !== process.env.NODE_ENV ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') :
|
|
98
|
-
'production' !== process.env.NODE_ENV ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') :
|
|
97
|
+
'production' !== process.env.NODE_ENV ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
|
|
98
|
+
'production' !== process.env.NODE_ENV ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
!(props.style == null || typeof props.style === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.') : invariant(false) : undefined;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function enqueuePutListener(id, registrationName, listener, transaction) {
|
|
104
104
|
if ('production' !== process.env.NODE_ENV) {
|
|
105
105
|
// IE8 has no API for event capturing and the `onScroll` event doesn't
|
|
106
106
|
// bubble.
|
|
107
|
-
'production' !== process.env.NODE_ENV ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') :
|
|
107
|
+
'production' !== process.env.NODE_ENV ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
|
|
108
108
|
}
|
|
109
109
|
var container = ReactMount.findReactContainerForID(id);
|
|
110
110
|
if (container) {
|
|
@@ -168,7 +168,7 @@ var hasOwnProperty = ({}).hasOwnProperty;
|
|
|
168
168
|
|
|
169
169
|
function validateDangerousTag(tag) {
|
|
170
170
|
if (!hasOwnProperty.call(validatedTagCache, tag)) {
|
|
171
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
171
|
+
!VALID_TAG_REGEX.test(tag) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
|
|
172
172
|
validatedTagCache[tag] = true;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -49,7 +49,7 @@ var ReactDOMIDOperations = {
|
|
|
49
49
|
*/
|
|
50
50
|
updatePropertyByID: function (id, name, value) {
|
|
51
51
|
var node = ReactMount.getNode(id);
|
|
52
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
52
|
+
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
|
|
53
53
|
|
|
54
54
|
// If we're updating to null or undefined, we should remove the property
|
|
55
55
|
// from the DOM node instead of inadvertantly setting to a string. This
|
|
@@ -71,7 +71,7 @@ var ReactDOMIDOperations = {
|
|
|
71
71
|
*/
|
|
72
72
|
deletePropertyByID: function (id, name, value) {
|
|
73
73
|
var node = ReactMount.getNode(id);
|
|
74
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
74
|
+
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
|
|
75
75
|
DOMPropertyOperations.deleteValueForProperty(node, name, value);
|
|
76
76
|
},
|
|
77
77
|
|
package/lib/ReactDOMInput.js
CHANGED
|
@@ -142,9 +142,9 @@ var ReactDOMInput = ReactClass.createClass({
|
|
|
142
142
|
continue;
|
|
143
143
|
}
|
|
144
144
|
var otherID = ReactMount.getID(otherNode);
|
|
145
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
145
|
+
!otherID ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
|
|
146
146
|
var otherInstance = instancesByReactID[otherID];
|
|
147
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
147
|
+
!otherInstance ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
|
|
148
148
|
// If this is a controlled radio button group, forcing the input that
|
|
149
149
|
// was previously checked to update will cause it to be come re-checked
|
|
150
150
|
// as appropriate.
|
package/lib/ReactDOMOption.js
CHANGED
|
@@ -16,7 +16,6 @@ var ReactChildren = require("./ReactChildren");
|
|
|
16
16
|
var ReactClass = require("./ReactClass");
|
|
17
17
|
var ReactDOMSelect = require("./ReactDOMSelect");
|
|
18
18
|
var ReactElement = require("./ReactElement");
|
|
19
|
-
var ReactInstanceMap = require("./ReactInstanceMap");
|
|
20
19
|
var ReactPropTypes = require("./ReactPropTypes");
|
|
21
20
|
|
|
22
21
|
var assign = require("./Object.assign");
|
|
@@ -48,11 +47,11 @@ var ReactDOMOption = ReactClass.createClass({
|
|
|
48
47
|
componentWillMount: function () {
|
|
49
48
|
// TODO (yungsters): Remove support for `selected` in <option>.
|
|
50
49
|
if ('production' !== process.env.NODE_ENV) {
|
|
51
|
-
'production' !== process.env.NODE_ENV ? warning(this.props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') :
|
|
50
|
+
'production' !== process.env.NODE_ENV ? warning(this.props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
// Look up whether this option is 'selected' via parent-based context
|
|
55
|
-
var context =
|
|
54
|
+
var context = this.context;
|
|
56
55
|
var selectValue = context[valueContextKey];
|
|
57
56
|
|
|
58
57
|
// If context key is null (e.g., no specified value or after initial mount)
|
|
@@ -94,7 +93,7 @@ var ReactDOMOption = ReactClass.createClass({
|
|
|
94
93
|
if (typeof child === 'string' || typeof child === 'number') {
|
|
95
94
|
content += child;
|
|
96
95
|
} else {
|
|
97
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Only strings and numbers are supported as <option> children.') :
|
|
96
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
|
|
98
97
|
}
|
|
99
98
|
});
|
|
100
99
|
|
package/lib/ReactDOMTextarea.js
CHANGED
|
@@ -61,11 +61,11 @@ var ReactDOMTextarea = ReactClass.createClass({
|
|
|
61
61
|
var children = this.props.children;
|
|
62
62
|
if (children != null) {
|
|
63
63
|
if ('production' !== process.env.NODE_ENV) {
|
|
64
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') :
|
|
64
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
|
|
65
65
|
}
|
|
66
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
66
|
+
!(defaultValue == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
|
|
67
67
|
if (Array.isArray(children)) {
|
|
68
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
68
|
+
!(children.length <= 1) ? 'production' !== process.env.NODE_ENV ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
|
|
69
69
|
children = children[0];
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -88,7 +88,7 @@ var ReactDOMTextarea = ReactClass.createClass({
|
|
|
88
88
|
// Clone `this.props` so we don't mutate the input.
|
|
89
89
|
var props = assign({}, this.props);
|
|
90
90
|
|
|
91
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
91
|
+
!(props.dangerouslySetInnerHTML == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
|
|
92
92
|
|
|
93
93
|
props.defaultValue = null;
|
|
94
94
|
props.value = null;
|
package/lib/ReactElement.js
CHANGED
|
@@ -43,7 +43,7 @@ function defineWarningProperty(object, key) {
|
|
|
43
43
|
},
|
|
44
44
|
|
|
45
45
|
set: function (value) {
|
|
46
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Don\'t set the %s property of the React element. Instead, ' + 'specify the correct value when initially creating the element.', key) :
|
|
46
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Don\'t set the %s property of the React element. Instead, ' + 'specify the correct value when initially creating the element.', key) : undefined;
|
|
47
47
|
this._store[key] = value;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -146,7 +146,7 @@ function warnAndMonitorForKeyUse(message, element, parentType) {
|
|
|
146
146
|
childOwnerAddendum = ' It was passed a child from ' + childOwnerName + '.';
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
'production' !== process.env.NODE_ENV ? warning(false, message + '%s%s See https://fb.me/react-warning-keys for more information.', parentOrOwnerAddendum, childOwnerAddendum) :
|
|
149
|
+
'production' !== process.env.NODE_ENV ? warning(false, message + '%s%s See https://fb.me/react-warning-keys for more information.', parentOrOwnerAddendum, childOwnerAddendum) : undefined;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/**
|
|
@@ -212,19 +212,19 @@ function checkPropTypes(componentName, propTypes, props, location) {
|
|
|
212
212
|
try {
|
|
213
213
|
// This is intentionally an invariant that gets caught. It's the same
|
|
214
214
|
// behavior as without this statement except with a better message.
|
|
215
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
215
|
+
!(typeof propTypes[propName] === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
|
|
216
216
|
error = propTypes[propName](props, propName, componentName, location);
|
|
217
217
|
} catch (ex) {
|
|
218
218
|
error = ex;
|
|
219
219
|
}
|
|
220
|
-
'production' !== process.env.NODE_ENV ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) :
|
|
220
|
+
'production' !== process.env.NODE_ENV ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
|
|
221
221
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
222
222
|
// Only monitor this failure once because there tends to be a lot of the
|
|
223
223
|
// same error.
|
|
224
224
|
loggedTypeFailures[error.message] = true;
|
|
225
225
|
|
|
226
226
|
var addendum = getDeclarationErrorAddendum();
|
|
227
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Failed propType: %s%s', error.message, addendum) :
|
|
227
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -258,7 +258,7 @@ function warnForPropsMutation(propName, element) {
|
|
|
258
258
|
ownerInfo = ' The element was created by ' + ownerName + '.';
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Don\'t set .props.%s of the React component%s. Instead, specify the ' + 'correct value when initially creating the element or use ' + 'React.cloneElement to make a new element with updated props.%s', propName, elementInfo, ownerInfo) :
|
|
261
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Don\'t set .props.%s of the React component%s. Instead, specify the ' + 'correct value when initially creating the element or use ' + 'React.cloneElement to make a new element with updated props.%s', propName, elementInfo, ownerInfo) : undefined;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
// Inline Object.is polyfill
|
|
@@ -325,7 +325,7 @@ function validatePropTypes(element) {
|
|
|
325
325
|
checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
|
|
326
326
|
}
|
|
327
327
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
328
|
-
'production' !== process.env.NODE_ENV ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') :
|
|
328
|
+
'production' !== process.env.NODE_ENV ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
|
|
@@ -336,7 +336,7 @@ var ReactElementValidator = {
|
|
|
336
336
|
createElement: function (type, props, children) {
|
|
337
337
|
// We warn in this case but don't throw. We expect the element creation to
|
|
338
338
|
// succeed and there will likely be errors in render.
|
|
339
|
-
'production' !== process.env.NODE_ENV ? warning(typeof type === 'string' || typeof type === 'function', 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) :
|
|
339
|
+
'production' !== process.env.NODE_ENV ? warning(typeof type === 'string' || typeof type === 'function', 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
|
|
340
340
|
|
|
341
341
|
var element = ReactElement.createElement.apply(this, arguments);
|
|
342
342
|
|
|
@@ -365,7 +365,7 @@ var ReactElementValidator = {
|
|
|
365
365
|
Object.defineProperty(validatedFactory, 'type', {
|
|
366
366
|
enumerable: false,
|
|
367
367
|
get: function () {
|
|
368
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') :
|
|
368
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
|
|
369
369
|
Object.defineProperty(this, 'type', {
|
|
370
370
|
value: type
|
|
371
371
|
});
|
|
@@ -48,7 +48,7 @@ ReactEmptyComponentType.prototype.componentWillUnmount = function () {
|
|
|
48
48
|
deregisterNullComponentID(internalInstance._rootNodeID);
|
|
49
49
|
};
|
|
50
50
|
ReactEmptyComponentType.prototype.render = function () {
|
|
51
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
51
|
+
!component ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Trying to return null from a render, but no null placeholder component ' + 'was injected.') : invariant(false) : undefined;
|
|
52
52
|
return component();
|
|
53
53
|
};
|
|
54
54
|
|
package/lib/ReactFragment.js
CHANGED
|
@@ -47,12 +47,12 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
47
47
|
Object.defineProperty(obj, key, {
|
|
48
48
|
enumerable: true,
|
|
49
49
|
get: function () {
|
|
50
|
-
'production' !== process.env.NODE_ENV ? warning(this[didWarnKey], 'A ReactFragment is an opaque type. Accessing any of its ' + 'properties is deprecated. Pass it to one of the React.Children ' + 'helpers.') :
|
|
50
|
+
'production' !== process.env.NODE_ENV ? warning(this[didWarnKey], 'A ReactFragment is an opaque type. Accessing any of its ' + 'properties is deprecated. Pass it to one of the React.Children ' + 'helpers.') : undefined;
|
|
51
51
|
this[didWarnKey] = true;
|
|
52
52
|
return this[fragmentKey][key];
|
|
53
53
|
},
|
|
54
54
|
set: function (value) {
|
|
55
|
-
'production' !== process.env.NODE_ENV ? warning(this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.') :
|
|
55
|
+
'production' !== process.env.NODE_ENV ? warning(this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.') : undefined;
|
|
56
56
|
this[didWarnKey] = true;
|
|
57
57
|
this[fragmentKey][key] = value;
|
|
58
58
|
}
|
|
@@ -80,11 +80,11 @@ var ReactFragment = {
|
|
|
80
80
|
create: function (object) {
|
|
81
81
|
if ('production' !== process.env.NODE_ENV) {
|
|
82
82
|
if (typeof object !== 'object' || !object || Array.isArray(object)) {
|
|
83
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment only accepts a single object.', object) :
|
|
83
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment only accepts a single object.', object) : undefined;
|
|
84
84
|
return object;
|
|
85
85
|
}
|
|
86
86
|
if (ReactElement.isValidElement(object)) {
|
|
87
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') :
|
|
87
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
|
|
88
88
|
return object;
|
|
89
89
|
}
|
|
90
90
|
if (canWarnForReactFragment) {
|
|
@@ -113,7 +113,7 @@ var ReactFragment = {
|
|
|
113
113
|
if ('production' !== process.env.NODE_ENV) {
|
|
114
114
|
if (canWarnForReactFragment) {
|
|
115
115
|
if (!fragment[fragmentKey]) {
|
|
116
|
-
'production' !== process.env.NODE_ENV ? warning(didWarnForFragment(fragment), 'Any use of a keyed object should be wrapped in ' + 'React.addons.createFragment(object) before being passed as a ' + 'child.') :
|
|
116
|
+
'production' !== process.env.NODE_ENV ? warning(didWarnForFragment(fragment), 'Any use of a keyed object should be wrapped in ' + 'React.addons.createFragment(object) before being passed as a ' + 'child.') : undefined;
|
|
117
117
|
return fragment;
|
|
118
118
|
}
|
|
119
119
|
return fragment[fragmentKey];
|
|
@@ -91,8 +91,8 @@ function getParentID(id) {
|
|
|
91
91
|
* @private
|
|
92
92
|
*/
|
|
93
93
|
function getNextDescendantID(ancestorID, destinationID) {
|
|
94
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
95
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
94
|
+
!(isValidID(ancestorID) && isValidID(destinationID)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
|
|
95
|
+
!isAncestorIDOf(ancestorID, destinationID) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
|
|
96
96
|
if (ancestorID === destinationID) {
|
|
97
97
|
return ancestorID;
|
|
98
98
|
}
|
|
@@ -134,7 +134,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
|
|
137
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
137
|
+
!isValidID(longestCommonID) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
|
|
138
138
|
return longestCommonID;
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -153,9 +153,9 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
153
153
|
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
154
154
|
start = start || '';
|
|
155
155
|
stop = stop || '';
|
|
156
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
156
|
+
!(start !== stop) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
|
|
157
157
|
var traverseUp = isAncestorIDOf(stop, start);
|
|
158
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
158
|
+
!(traverseUp || isAncestorIDOf(start, stop)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
|
|
159
159
|
// Traverse from `start` to `stop` one depth at a time.
|
|
160
160
|
var depth = 0;
|
|
161
161
|
var traverse = traverseUp ? getParentID : getNextDescendantID;
|
|
@@ -168,7 +168,7 @@ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
|
168
168
|
// Only break //after// visiting `stop`.
|
|
169
169
|
break;
|
|
170
170
|
}
|
|
171
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
171
|
+
!(depth++ < MAX_TREE_DEPTH) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop) : invariant(false) : undefined;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|