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/ReactMount.js
CHANGED
|
@@ -115,7 +115,7 @@ function getID(node) {
|
|
|
115
115
|
if (nodeCache.hasOwnProperty(id)) {
|
|
116
116
|
var cached = nodeCache[id];
|
|
117
117
|
if (cached !== node) {
|
|
118
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
118
|
+
!!isValid(cached, id) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
|
|
119
119
|
|
|
120
120
|
nodeCache[id] = node;
|
|
121
121
|
}
|
|
@@ -193,7 +193,7 @@ function getNodeFromInstance(instance) {
|
|
|
193
193
|
*/
|
|
194
194
|
function isValid(node, id) {
|
|
195
195
|
if (node) {
|
|
196
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
196
|
+
!(internalGetID(node) === id) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
|
|
197
197
|
|
|
198
198
|
var container = ReactMount.findReactContainerForID(id);
|
|
199
199
|
if (container && containsNode(container, node)) {
|
|
@@ -364,7 +364,7 @@ var ReactMount = {
|
|
|
364
364
|
* @return {string} reactRoot ID prefix
|
|
365
365
|
*/
|
|
366
366
|
_registerComponent: function (nextComponent, container) {
|
|
367
|
-
|
|
367
|
+
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? 'production' !== process.env.NODE_ENV ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
|
|
368
368
|
|
|
369
369
|
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
|
|
370
370
|
|
|
@@ -384,7 +384,7 @@ var ReactMount = {
|
|
|
384
384
|
// Various parts of our code (such as ReactCompositeComponent's
|
|
385
385
|
// _renderValidatedComponent) assume that calls to render aren't nested;
|
|
386
386
|
// verify that that's the case.
|
|
387
|
-
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') :
|
|
387
|
+
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
|
|
388
388
|
|
|
389
389
|
var componentInstance = instantiateReactComponent(nextElement, null);
|
|
390
390
|
var reactRootID = ReactMount._registerComponent(componentInstance, container);
|
|
@@ -417,16 +417,16 @@ var ReactMount = {
|
|
|
417
417
|
* @return {ReactComponent} Component instance rendered in `container`.
|
|
418
418
|
*/
|
|
419
419
|
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
|
420
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
420
|
+
!(parentComponent != null && parentComponent._reactInternalInstance != null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
|
|
421
421
|
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
|
|
422
422
|
},
|
|
423
423
|
|
|
424
424
|
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
|
425
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
425
|
+
!ReactElement.isValidElement(nextElement) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'React.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
|
|
426
426
|
// Check if it quacks like an element
|
|
427
|
-
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(
|
|
427
|
+
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
|
|
428
428
|
|
|
429
|
-
'production' !== process.env.NODE_ENV ? warning(container && container.tagName !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') :
|
|
429
|
+
'production' !== process.env.NODE_ENV ? warning(container && container.tagName !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
|
|
430
430
|
|
|
431
431
|
var prevComponent = instancesByReactRootID[getReactRootID(container)];
|
|
432
432
|
|
|
@@ -447,7 +447,7 @@ var ReactMount = {
|
|
|
447
447
|
var rootElementSibling = reactRootElement;
|
|
448
448
|
while (rootElementSibling) {
|
|
449
449
|
if (ReactMount.isRenderedByReact(rootElementSibling)) {
|
|
450
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') :
|
|
450
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
|
|
451
451
|
break;
|
|
452
452
|
}
|
|
453
453
|
|
|
@@ -505,7 +505,7 @@ var ReactMount = {
|
|
|
505
505
|
*/
|
|
506
506
|
constructAndRenderComponentByID: function (constructor, props, id) {
|
|
507
507
|
var domNode = document.getElementById(id);
|
|
508
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
508
|
+
!domNode ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Tried to get element with id of "%s" but it is not present on the page.', id) : invariant(false) : undefined;
|
|
509
509
|
return ReactMount.constructAndRenderComponent(constructor, props, domNode);
|
|
510
510
|
},
|
|
511
511
|
|
|
@@ -543,9 +543,9 @@ var ReactMount = {
|
|
|
543
543
|
// _renderValidatedComponent) assume that calls to render aren't nested;
|
|
544
544
|
// verify that that's the case. (Strictly speaking, unmounting won't cause a
|
|
545
545
|
// render but we still don't expect to be in a render call here.)
|
|
546
|
-
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') :
|
|
546
|
+
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
|
|
547
547
|
|
|
548
|
-
|
|
548
|
+
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
|
|
549
549
|
|
|
550
550
|
var reactRootID = getReactRootID(container);
|
|
551
551
|
var component = instancesByReactRootID[reactRootID];
|
|
@@ -578,7 +578,7 @@ var ReactMount = {
|
|
|
578
578
|
'production' !== process.env.NODE_ENV ? warning(
|
|
579
579
|
// Call internalGetID here because getID calls isValid which calls
|
|
580
580
|
// findReactContainerForID (this function).
|
|
581
|
-
internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') :
|
|
581
|
+
internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
|
|
582
582
|
var containerChild = container.firstChild;
|
|
583
583
|
if (containerChild && reactRootID === internalGetID(containerChild)) {
|
|
584
584
|
// If the container has a new child with the same ID as the old
|
|
@@ -587,7 +587,7 @@ var ReactMount = {
|
|
|
587
587
|
// warning is when the container is empty.
|
|
588
588
|
rootElementsByReactRootID[reactRootID] = containerChild;
|
|
589
589
|
} else {
|
|
590
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container:', rootElement.parentNode) :
|
|
590
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container:', rootElement.parentNode) : undefined;
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
}
|
|
@@ -706,11 +706,11 @@ var ReactMount = {
|
|
|
706
706
|
|
|
707
707
|
firstChildren.length = 0;
|
|
708
708
|
|
|
709
|
-
'production' !== process.env.NODE_ENV ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false);
|
|
709
|
+
!false ? 'production' !== process.env.NODE_ENV ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
|
|
710
710
|
},
|
|
711
711
|
|
|
712
712
|
_mountImageIntoNode: function (markup, container, shouldReuseMarkup) {
|
|
713
|
-
|
|
713
|
+
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
|
|
714
714
|
|
|
715
715
|
if (shouldReuseMarkup) {
|
|
716
716
|
var rootElement = getReactRootElementInContainer(container);
|
|
@@ -726,15 +726,15 @@ var ReactMount = {
|
|
|
726
726
|
var diffIndex = firstDifferenceIndex(markup, rootMarkup);
|
|
727
727
|
var difference = ' (client) ' + markup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
|
|
728
728
|
|
|
729
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
729
|
+
!(container.nodeType !== DOC_NODE_TYPE) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
|
|
730
730
|
|
|
731
731
|
if ('production' !== process.env.NODE_ENV) {
|
|
732
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) :
|
|
732
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
|
|
737
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
737
|
+
!(container.nodeType !== DOC_NODE_TYPE) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See React.renderToString() for server rendering.') : invariant(false) : undefined;
|
|
738
738
|
|
|
739
739
|
setInnerHTML(container, markup);
|
|
740
740
|
},
|
|
@@ -68,7 +68,7 @@ function getComponentClassForElement(element) {
|
|
|
68
68
|
* @return {function} The internal class constructor function.
|
|
69
69
|
*/
|
|
70
70
|
function createInternalComponent(element) {
|
|
71
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
71
|
+
!genericComponentClass ? 'production' !== process.env.NODE_ENV ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
|
|
72
72
|
return new genericComponentClass(element.type, element.props);
|
|
73
73
|
}
|
|
74
74
|
|
package/lib/ReactOwner.js
CHANGED
|
@@ -64,7 +64,7 @@ var ReactOwner = {
|
|
|
64
64
|
* @internal
|
|
65
65
|
*/
|
|
66
66
|
addComponentAsRefTo: function (component, ref, owner) {
|
|
67
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
67
|
+
!ReactOwner.isValidOwner(owner) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to add a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
|
|
68
68
|
owner.attachRef(ref, component);
|
|
69
69
|
},
|
|
70
70
|
|
|
@@ -78,7 +78,7 @@ var ReactOwner = {
|
|
|
78
78
|
* @internal
|
|
79
79
|
*/
|
|
80
80
|
removeComponentAsRefFrom: function (component, ref, owner) {
|
|
81
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
81
|
+
!ReactOwner.isValidOwner(owner) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to remove a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
|
|
82
82
|
// Check that `component` is still the current ref because we do not want to
|
|
83
83
|
// detach the ref if another component stole it.
|
|
84
84
|
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
|
package/lib/ReactPropTypes.js
CHANGED
|
@@ -171,6 +171,12 @@ function createInstanceTypeChecker(expectedClass) {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
function createEnumTypeChecker(expectedValues) {
|
|
174
|
+
if (!Array.isArray(expectedValues)) {
|
|
175
|
+
return createChainableTypeChecker(function () {
|
|
176
|
+
return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
174
180
|
function validate(props, propName, componentName, location, propFullName) {
|
|
175
181
|
var propValue = props[propName];
|
|
176
182
|
for (var i = 0; i < expectedValues.length; i++) {
|
|
@@ -208,6 +214,12 @@ function createObjectOfTypeChecker(typeChecker) {
|
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
217
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
218
|
+
return createChainableTypeChecker(function () {
|
|
219
|
+
return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
211
223
|
function validate(props, propName, componentName, location, propFullName) {
|
|
212
224
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
213
225
|
var checker = arrayOfTypeCheckers[i];
|
|
@@ -25,7 +25,7 @@ var invariant = require("./invariant");
|
|
|
25
25
|
* @return {string} the HTML markup
|
|
26
26
|
*/
|
|
27
27
|
function renderToString(element) {
|
|
28
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
28
|
+
!ReactElement.isValidElement(element) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
|
29
29
|
|
|
30
30
|
var transaction;
|
|
31
31
|
try {
|
|
@@ -48,7 +48,7 @@ function renderToString(element) {
|
|
|
48
48
|
* (for generating static pages)
|
|
49
49
|
*/
|
|
50
50
|
function renderToStaticMarkup(element) {
|
|
51
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
51
|
+
!ReactElement.isValidElement(element) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
|
52
52
|
|
|
53
53
|
var transaction;
|
|
54
54
|
try {
|
package/lib/ReactUpdateQueue.js
CHANGED
|
@@ -32,7 +32,7 @@ function enqueueUpdate(internalInstance) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
35
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
35
|
+
!(ReactCurrentOwner.current == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : invariant(false) : undefined;
|
|
36
36
|
|
|
37
37
|
var internalInstance = ReactInstanceMap.get(publicInstance);
|
|
38
38
|
if (!internalInstance) {
|
|
@@ -40,7 +40,7 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
|
40
40
|
// Only warn when we have a callerName. Otherwise we should be silent.
|
|
41
41
|
// We're probably calling from enqueueCallback. We don't want to warn
|
|
42
42
|
// there because we already warned for the corresponding lifecycle method.
|
|
43
|
-
'production' !== process.env.NODE_ENV ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted ' + 'component. This is a no-op.', callerName, callerName) :
|
|
43
|
+
'production' !== process.env.NODE_ENV ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted ' + 'component. This is a no-op.', callerName, callerName) : undefined;
|
|
44
44
|
}
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
@@ -67,7 +67,7 @@ var ReactUpdateQueue = {
|
|
|
67
67
|
* @internal
|
|
68
68
|
*/
|
|
69
69
|
enqueueCallback: function (publicInstance, callback) {
|
|
70
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
70
|
+
!(typeof callback === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
|
71
71
|
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
|
|
72
72
|
|
|
73
73
|
// Previously we would throw an error if we didn't have an internal
|
|
@@ -92,7 +92,7 @@ var ReactUpdateQueue = {
|
|
|
92
92
|
},
|
|
93
93
|
|
|
94
94
|
enqueueCallbackInternal: function (internalInstance, callback) {
|
|
95
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
95
|
+
!(typeof callback === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
|
96
96
|
if (internalInstance._pendingCallbacks) {
|
|
97
97
|
internalInstance._pendingCallbacks.push(callback);
|
|
98
98
|
} else {
|
|
@@ -187,7 +187,7 @@ var ReactUpdateQueue = {
|
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
190
|
+
!internalInstance._isTopLevel ? 'production' !== process.env.NODE_ENV ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
|
191
191
|
|
|
192
192
|
// Merge with the pending element if it exists, otherwise with existing
|
|
193
193
|
// element props.
|
|
@@ -212,7 +212,7 @@ var ReactUpdateQueue = {
|
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
215
|
+
!internalInstance._isTopLevel ? 'production' !== process.env.NODE_ENV ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
|
216
216
|
|
|
217
217
|
// Merge with the pending element if it exists, otherwise with existing
|
|
218
218
|
// element props.
|
package/lib/ReactUpdates.js
CHANGED
|
@@ -29,7 +29,7 @@ var asapEnqueued = false;
|
|
|
29
29
|
var batchingStrategy = null;
|
|
30
30
|
|
|
31
31
|
function ensureInjected() {
|
|
32
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
32
|
+
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
var NESTED_UPDATES = {
|
|
@@ -109,7 +109,7 @@ function mountOrderComparator(c1, c2) {
|
|
|
109
109
|
|
|
110
110
|
function runBatchedUpdates(transaction) {
|
|
111
111
|
var len = transaction.dirtyComponentsLength;
|
|
112
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
112
|
+
!(len === dirtyComponents.length) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
|
|
113
113
|
|
|
114
114
|
// Since reconciling a component higher in the owner hierarchy usually (not
|
|
115
115
|
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
|
@@ -173,7 +173,7 @@ function enqueueUpdate(component) {
|
|
|
173
173
|
// verify that that's the case. (This is called by each top-level update
|
|
174
174
|
// function, like setProps, setState, forceUpdate, etc.; creation and
|
|
175
175
|
// destruction of top-level components is guarded in ReactMount.)
|
|
176
|
-
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, 'enqueueUpdate(): Render methods should be a pure function of props ' + 'and state; triggering nested component updates from render is not ' + 'allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.') :
|
|
176
|
+
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, 'enqueueUpdate(): Render methods should be a pure function of props ' + 'and state; triggering nested component updates from render is not ' + 'allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.') : undefined;
|
|
177
177
|
|
|
178
178
|
if (!batchingStrategy.isBatchingUpdates) {
|
|
179
179
|
batchingStrategy.batchedUpdates(enqueueUpdate, component);
|
|
@@ -188,21 +188,21 @@ function enqueueUpdate(component) {
|
|
|
188
188
|
* if no updates are currently being performed.
|
|
189
189
|
*/
|
|
190
190
|
function asap(callback, context) {
|
|
191
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
191
|
+
!batchingStrategy.isBatchingUpdates ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
|
|
192
192
|
asapCallbackQueue.enqueue(callback, context);
|
|
193
193
|
asapEnqueued = true;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
var ReactUpdatesInjection = {
|
|
197
197
|
injectReconcileTransaction: function (ReconcileTransaction) {
|
|
198
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
198
|
+
!ReconcileTransaction ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
|
|
199
199
|
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
|
|
200
200
|
},
|
|
201
201
|
|
|
202
202
|
injectBatchingStrategy: function (_batchingStrategy) {
|
|
203
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
204
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
205
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
203
|
+
!_batchingStrategy ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
|
|
204
|
+
!(typeof _batchingStrategy.batchedUpdates === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
|
|
205
|
+
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
|
|
206
206
|
batchingStrategy = _batchingStrategy;
|
|
207
207
|
}
|
|
208
208
|
};
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -309,7 +309,7 @@ var SimpleEventPlugin = {
|
|
|
309
309
|
executeDispatch: function (event, listener, domID) {
|
|
310
310
|
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
|
|
311
311
|
|
|
312
|
-
'production' !== process.env.NODE_ENV ? warning(typeof returnValue !== 'boolean', 'Returning `false` from an event handler is deprecated and will be ' + 'ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.') :
|
|
312
|
+
'production' !== process.env.NODE_ENV ? warning(typeof returnValue !== 'boolean', 'Returning `false` from an event handler is deprecated and will be ' + 'ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.') : undefined;
|
|
313
313
|
|
|
314
314
|
if (returnValue === false) {
|
|
315
315
|
event.stopPropagation();
|
|
@@ -401,7 +401,7 @@ var SimpleEventPlugin = {
|
|
|
401
401
|
EventConstructor = SyntheticClipboardEvent;
|
|
402
402
|
break;
|
|
403
403
|
}
|
|
404
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
404
|
+
!EventConstructor ? 'production' !== process.env.NODE_ENV ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
|
405
405
|
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent);
|
|
406
406
|
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
407
407
|
return event;
|
package/lib/Transaction.js
CHANGED
|
@@ -116,7 +116,7 @@ var Mixin = {
|
|
|
116
116
|
* @return Return value from `method`.
|
|
117
117
|
*/
|
|
118
118
|
perform: function (method, scope, a, b, c, d, e, f) {
|
|
119
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
119
|
+
!!this.isInTransaction() ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
|
|
120
120
|
var errorThrown;
|
|
121
121
|
var ret;
|
|
122
122
|
try {
|
|
@@ -180,7 +180,7 @@ var Mixin = {
|
|
|
180
180
|
* invoked).
|
|
181
181
|
*/
|
|
182
182
|
closeAll: function (startIndex) {
|
|
183
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
183
|
+
!this.isInTransaction() ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
|
|
184
184
|
var transactionWrappers = this.transactionWrappers;
|
|
185
185
|
for (var i = startIndex; i < transactionWrappers.length; i++) {
|
|
186
186
|
var wrapper = transactionWrappers[i];
|
package/lib/accumulateInto.js
CHANGED
|
@@ -28,7 +28,7 @@ var invariant = require("./invariant");
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
function accumulateInto(current, next) {
|
|
31
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
31
|
+
!(next != null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
|
|
32
32
|
if (current == null) {
|
|
33
33
|
return next;
|
|
34
34
|
}
|
package/lib/cloneWithProps.js
CHANGED
|
@@ -31,7 +31,7 @@ var CHILDREN_PROP = keyOf({ children: null });
|
|
|
31
31
|
*/
|
|
32
32
|
function cloneWithProps(child, props) {
|
|
33
33
|
if ('production' !== process.env.NODE_ENV) {
|
|
34
|
-
'production' !== process.env.NODE_ENV ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') :
|
|
34
|
+
'production' !== process.env.NODE_ENV ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
var newProps = ReactPropTransferer.mergeProps(props, child.props);
|
|
@@ -37,7 +37,7 @@ function createFullPageComponent(tag) {
|
|
|
37
37
|
displayName: 'ReactFullPageComponent' + tag,
|
|
38
38
|
|
|
39
39
|
componentWillUnmount: function () {
|
|
40
|
-
'production' !== process.env.NODE_ENV ? invariant(false, '%s tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, <head>, ' + 'and <body>) reliably and efficiently. To fix this, have a single ' + 'top-level component that never unmounts render these elements.', this.constructor.displayName) : invariant(false);
|
|
40
|
+
!false ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, <head>, ' + 'and <body>) reliably and efficiently. To fix this, have a single ' + 'top-level component that never unmounts render these elements.', this.constructor.displayName) : invariant(false) : undefined;
|
|
41
41
|
},
|
|
42
42
|
|
|
43
43
|
render: function () {
|
|
@@ -53,7 +53,7 @@ function getNodeName(markup) {
|
|
|
53
53
|
*/
|
|
54
54
|
function createNodesFromMarkup(markup, handleScript) {
|
|
55
55
|
var node = dummyNode;
|
|
56
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
56
|
+
!!!dummyNode ? 'production' !== process.env.NODE_ENV ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
|
|
57
57
|
var nodeName = getNodeName(markup);
|
|
58
58
|
|
|
59
59
|
var wrap = nodeName && getMarkupWrap(nodeName);
|
|
@@ -70,7 +70,7 @@ function createNodesFromMarkup(markup, handleScript) {
|
|
|
70
70
|
|
|
71
71
|
var scripts = node.getElementsByTagName('script');
|
|
72
72
|
if (scripts.length) {
|
|
73
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
73
|
+
!handleScript ? 'production' !== process.env.NODE_ENV ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
|
|
74
74
|
createArrayFromMixed(scripts).forEach(handleScript);
|
|
75
75
|
}
|
|
76
76
|
|
package/lib/findDOMNode.js
CHANGED
|
@@ -30,7 +30,7 @@ function findDOMNode(componentOrElement) {
|
|
|
30
30
|
if ('production' !== process.env.NODE_ENV) {
|
|
31
31
|
var owner = ReactCurrentOwner.current;
|
|
32
32
|
if (owner !== null) {
|
|
33
|
-
'production' !== process.env.NODE_ENV ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + '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') :
|
|
33
|
+
'production' !== process.env.NODE_ENV ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + '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;
|
|
34
34
|
owner._warnedAboutRefsInRender = true;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -43,8 +43,8 @@ function findDOMNode(componentOrElement) {
|
|
|
43
43
|
if (ReactInstanceMap.has(componentOrElement)) {
|
|
44
44
|
return ReactMount.getNodeFromInstance(componentOrElement);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
'production' !== process.env.NODE_ENV ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false);
|
|
46
|
+
!(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Component (with keys: %s) contains `render` method ' + 'but is not mounted in the DOM', Object.keys(componentOrElement)) : invariant(false) : undefined;
|
|
47
|
+
!false ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
module.exports = findDOMNode;
|
package/lib/flattenChildren.js
CHANGED
|
@@ -24,7 +24,7 @@ function flattenSingleChildIntoContext(traverseContext, child, name) {
|
|
|
24
24
|
var result = traverseContext;
|
|
25
25
|
var keyUnique = result[name] === undefined;
|
|
26
26
|
if ('production' !== process.env.NODE_ENV) {
|
|
27
|
-
'production' !== process.env.NODE_ENV ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) :
|
|
27
|
+
'production' !== process.env.NODE_ENV ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
|
|
28
28
|
}
|
|
29
29
|
if (keyUnique && child != null) {
|
|
30
30
|
result[name] = child;
|
package/lib/getMarkupWrap.js
CHANGED
|
@@ -97,7 +97,7 @@ var markupWrap = {
|
|
|
97
97
|
* @return {?array} Markup wrap configuration, if applicable.
|
|
98
98
|
*/
|
|
99
99
|
function getMarkupWrap(nodeName) {
|
|
100
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
100
|
+
!!!dummyNode ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
|
|
101
101
|
if (!markupWrap.hasOwnProperty(nodeName)) {
|
|
102
102
|
nodeName = '*';
|
|
103
103
|
}
|
|
@@ -55,7 +55,7 @@ function instantiateReactComponent(node, parentCompositeType) {
|
|
|
55
55
|
if (typeof node === 'object') {
|
|
56
56
|
var element = node;
|
|
57
57
|
if ('production' !== process.env.NODE_ENV) {
|
|
58
|
-
'production' !== process.env.NODE_ENV ? warning(element && (typeof element.type === 'function' || typeof element.type === 'string'), 'Only functions or strings can be mounted as React components.') :
|
|
58
|
+
'production' !== process.env.NODE_ENV ? warning(element && (typeof element.type === 'function' || typeof element.type === 'string'), 'Only functions or strings can be mounted as React components.') : undefined;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Special case string values
|
|
@@ -75,11 +75,11 @@ function instantiateReactComponent(node, parentCompositeType) {
|
|
|
75
75
|
} else if (typeof node === 'string' || typeof node === 'number') {
|
|
76
76
|
instance = ReactNativeComponent.createInstanceForText(node);
|
|
77
77
|
} else {
|
|
78
|
-
'production' !== process.env.NODE_ENV ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false);
|
|
78
|
+
!false ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
if ('production' !== process.env.NODE_ENV) {
|
|
82
|
-
'production' !== process.env.NODE_ENV ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') :
|
|
82
|
+
'production' !== process.env.NODE_ENV ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// Sets up the instance. This can probably just move into the constructor now.
|