react 0.13.3 → 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.
- package/README.md +5 -2
- package/addons.js +7 -0
- package/dist/JSXTransformer.js +4101 -2432
- package/dist/react-with-addons.js +4389 -6277
- package/dist/react-with-addons.min.js +6 -8
- package/dist/react.js +4028 -5697
- package/dist/react.min.js +5 -6
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +16 -5
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +4 -3
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +26 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +86 -147
- package/lib/DOMPropertyOperations.js +91 -67
- package/lib/Danger.js +19 -62
- package/lib/DefaultEventPluginOrder.js +2 -12
- package/lib/EnterLeaveEventPlugin.js +11 -33
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +11 -13
- package/lib/EventPluginHub.js +44 -47
- package/lib/EventPluginRegistry.js +18 -74
- package/lib/EventPluginUtils.js +33 -44
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +15 -20
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +71 -89
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +20 -11
- package/lib/React.js +9 -129
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +26 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +24 -31
- package/lib/ReactClass.js +96 -267
- package/lib/ReactComponent.js +28 -57
- package/lib/ReactComponentBrowserEnvironment.js +4 -8
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +6 -7
- package/lib/ReactCompositeComponent.js +115 -381
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +16 -28
- package/lib/ReactDOMClient.js +90 -0
- package/lib/ReactDOMComponent.js +468 -156
- package/lib/ReactDOMIDOperations.js +25 -22
- package/lib/ReactDOMInput.js +79 -108
- package/lib/ReactDOMOption.js +58 -20
- package/lib/ReactDOMSelect.js +95 -83
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +44 -69
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +20 -76
- package/lib/ReactDefaultPerf.js +36 -69
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +26 -120
- package/lib/ReactElementValidator.js +56 -192
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +3 -3
- package/lib/ReactEventEmitterMixin.js +3 -13
- package/lib/ReactEventListener.js +58 -40
- package/lib/ReactFragment.js +33 -59
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +14 -23
- package/lib/ReactInstanceHandles.js +29 -58
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +142 -285
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +6 -15
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +7 -24
- package/lib/ReactPerf.js +8 -12
- package/lib/ReactPropTransferer.js +4 -4
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +41 -61
- package/lib/ReactReconcileTransaction.js +11 -36
- package/lib/ReactReconciler.js +14 -26
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +20 -15
- package/lib/ReactServerRenderingTransaction.js +9 -34
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +137 -190
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +69 -107
- package/lib/ReactUpdates.js +26 -81
- package/lib/ReactWithAddons.js +5 -6
- package/lib/SVGDOMPropertyConfig.js +39 -4
- package/lib/SelectEventPlugin.js +31 -33
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +138 -130
- package/lib/SyntheticClipboardEvent.js +5 -9
- package/lib/SyntheticCompositionEvent.js +4 -10
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +14 -15
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +4 -10
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +10 -16
- package/lib/SyntheticTouchEvent.js +3 -3
- package/lib/SyntheticUIEvent.js +5 -5
- package/lib/SyntheticWheelEvent.js +13 -17
- package/lib/Transaction.js +22 -28
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -4
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +6 -12
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/deprecated.js +47 -0
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +7 -27
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +3 -3
- package/lib/getActiveElement.js +4 -2
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +2 -4
- package/lib/getMarkupWrap.js +18 -40
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTextContentAccessor.js +2 -4
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +3 -1
- package/lib/hyphenateStyleName.js +2 -2
- package/lib/instantiateReactComponent.js +23 -43
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +3 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +3 -3
- package/lib/keyMirror.js +3 -6
- package/lib/keyOf.js +4 -3
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +2 -2
- package/lib/onlyChild.js +2 -5
- package/lib/performance.js +2 -5
- package/lib/performanceNow.js +3 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +16 -0
- package/lib/setInnerHTML.js +11 -8
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +24 -0
- package/lib/shallowEqual.js +17 -11
- package/lib/shouldUpdateReactComponent.js +3 -64
- package/lib/toArray.js +8 -19
- package/lib/traverseAllChildren.js +23 -90
- package/lib/update.js +25 -85
- package/lib/validateDOMNesting.js +363 -0
- package/lib/warning.js +15 -17
- package/package.json +3 -3
- package/react.js +53 -1
- package/lib/LocalEventTrapMixin.js +0 -53
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactContext.js +0 -74
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/ReactPutListenerQueue.js +0 -54
- package/lib/createFullPageComponent.js +0 -58
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
package/lib/ViewportMetrics.js
CHANGED
|
@@ -17,11 +17,11 @@ var ViewportMetrics = {
|
|
|
17
17
|
|
|
18
18
|
currentScrollTop: 0,
|
|
19
19
|
|
|
20
|
-
refreshScrollValues: function(scrollPosition) {
|
|
20
|
+
refreshScrollValues: function (scrollPosition) {
|
|
21
21
|
ViewportMetrics.currentScrollLeft = scrollPosition.x;
|
|
22
22
|
ViewportMetrics.currentScrollTop = scrollPosition.y;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
module.exports = ViewportMetrics;
|
|
27
|
+
module.exports = ViewportMetrics;
|
package/lib/accumulateInto.js
CHANGED
|
@@ -28,10 +28,7 @@ var invariant = require("./invariant");
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
function accumulateInto(current, next) {
|
|
31
|
-
(
|
|
32
|
-
next != null,
|
|
33
|
-
'accumulateInto(...): Accumulated items must not be null or undefined.'
|
|
34
|
-
) : invariant(next != null));
|
|
31
|
+
!(next != null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
|
|
35
32
|
if (current == null) {
|
|
36
33
|
return next;
|
|
37
34
|
}
|
|
@@ -59,4 +56,4 @@ function accumulateInto(current, next) {
|
|
|
59
56
|
return [current, next];
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
module.exports = accumulateInto;
|
|
59
|
+
module.exports = accumulateInto;
|
package/lib/adler32.js
CHANGED
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
* @providesModule adler32
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/* jslint bitwise:true */
|
|
13
|
-
|
|
14
12
|
'use strict';
|
|
15
13
|
|
|
16
14
|
var MOD = 65521;
|
|
@@ -26,7 +24,7 @@ function adler32(data) {
|
|
|
26
24
|
a = (a + data.charCodeAt(i)) % MOD;
|
|
27
25
|
b = (b + a) % MOD;
|
|
28
26
|
}
|
|
29
|
-
return a |
|
|
27
|
+
return a | b << 16;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
module.exports = adler32;
|
|
30
|
+
module.exports = adler32;
|
package/lib/camelize.js
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
"use strict";
|
|
14
|
+
|
|
13
15
|
var _hyphenPattern = /-(.)/g;
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -22,9 +24,9 @@ var _hyphenPattern = /-(.)/g;
|
|
|
22
24
|
* @return {string}
|
|
23
25
|
*/
|
|
24
26
|
function camelize(string) {
|
|
25
|
-
return string.replace(_hyphenPattern, function(_, character) {
|
|
27
|
+
return string.replace(_hyphenPattern, function (_, character) {
|
|
26
28
|
return character.toUpperCase();
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
module.exports = camelize;
|
|
32
|
+
module.exports = camelize;
|
package/lib/camelizeStyleName.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var camelize = require("./camelize");
|
|
16
16
|
|
|
@@ -37,4 +37,4 @@ function camelizeStyleName(string) {
|
|
|
37
37
|
return camelize(string.replace(msPattern, 'ms-'));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
module.exports = camelizeStyleName;
|
|
40
|
+
module.exports = camelizeStyleName;
|
package/lib/cloneWithProps.js
CHANGED
|
@@ -18,7 +18,7 @@ var ReactPropTransferer = require("./ReactPropTransferer");
|
|
|
18
18
|
var keyOf = require("./keyOf");
|
|
19
19
|
var warning = require("./warning");
|
|
20
20
|
|
|
21
|
-
var CHILDREN_PROP = keyOf({children: null});
|
|
21
|
+
var CHILDREN_PROP = keyOf({ children: null });
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Sometimes you want to change the props of a child passed to you. Usually
|
|
@@ -30,26 +30,20 @@ var CHILDREN_PROP = keyOf({children: null});
|
|
|
30
30
|
* @return {ReactElement} a clone of child with props merged in.
|
|
31
31
|
*/
|
|
32
32
|
function cloneWithProps(child, props) {
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
!child.ref,
|
|
36
|
-
'You are calling cloneWithProps() on a child with a ref. This is ' +
|
|
37
|
-
'dangerous because you\'re creating a new child which will not be ' +
|
|
38
|
-
'added as a ref to its parent.'
|
|
39
|
-
) : null);
|
|
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.') : undefined;
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
var newProps = ReactPropTransferer.mergeProps(props, child.props);
|
|
43
38
|
|
|
44
39
|
// Use `child.props.children` if it is provided.
|
|
45
|
-
if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
|
|
46
|
-
child.props.hasOwnProperty(CHILDREN_PROP)) {
|
|
40
|
+
if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) {
|
|
47
41
|
newProps.children = child.props.children;
|
|
48
42
|
}
|
|
49
43
|
|
|
50
|
-
// The current API doesn't retain _owner
|
|
44
|
+
// The current API doesn't retain _owner, which is why this
|
|
51
45
|
// doesn't use ReactElement.cloneAndReplaceProps.
|
|
52
46
|
return ReactElement.createElement(child.type, newProps);
|
|
53
47
|
}
|
|
54
48
|
|
|
55
|
-
module.exports = cloneWithProps;
|
|
49
|
+
module.exports = cloneWithProps;
|
package/lib/containsNode.js
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
13
15
|
var isTextNode = require("./isTextNode");
|
|
14
16
|
|
|
15
17
|
/*jslint bitwise:true */
|
|
@@ -21,22 +23,33 @@ var isTextNode = require("./isTextNode");
|
|
|
21
23
|
* @param {?DOMNode} innerNode Inner DOM node.
|
|
22
24
|
* @return {boolean} True if `outerNode` contains or is `innerNode`.
|
|
23
25
|
*/
|
|
24
|
-
function containsNode(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
function containsNode(_x, _x2) {
|
|
27
|
+
var _again = true;
|
|
28
|
+
|
|
29
|
+
_function: while (_again) {
|
|
30
|
+
var outerNode = _x,
|
|
31
|
+
innerNode = _x2;
|
|
32
|
+
_again = false;
|
|
33
|
+
|
|
34
|
+
if (!outerNode || !innerNode) {
|
|
35
|
+
return false;
|
|
36
|
+
} else if (outerNode === innerNode) {
|
|
37
|
+
return true;
|
|
38
|
+
} else if (isTextNode(outerNode)) {
|
|
39
|
+
return false;
|
|
40
|
+
} else if (isTextNode(innerNode)) {
|
|
41
|
+
_x = outerNode;
|
|
42
|
+
_x2 = innerNode.parentNode;
|
|
43
|
+
_again = true;
|
|
44
|
+
continue _function;
|
|
45
|
+
} else if (outerNode.contains) {
|
|
46
|
+
return outerNode.contains(innerNode);
|
|
47
|
+
} else if (outerNode.compareDocumentPosition) {
|
|
48
|
+
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
|
|
49
|
+
} else {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
39
52
|
}
|
|
40
53
|
}
|
|
41
54
|
|
|
42
|
-
module.exports = containsNode;
|
|
55
|
+
module.exports = containsNode;
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
13
15
|
var toArray = require("./toArray");
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -30,23 +32,11 @@ var toArray = require("./toArray");
|
|
|
30
32
|
function hasArrayNature(obj) {
|
|
31
33
|
return (
|
|
32
34
|
// not null/false
|
|
33
|
-
!!obj &&
|
|
34
|
-
// arrays are objects, NodeLists are functions in Safari
|
|
35
|
-
(typeof obj == 'object' || typeof obj == 'function') &&
|
|
36
|
-
// quacks like an array
|
|
37
|
-
('length' in obj) &&
|
|
35
|
+
!!obj && (typeof obj == 'object' || typeof obj == 'function') && 'length' in obj &&
|
|
38
36
|
// not window
|
|
39
|
-
!('setInterval' in obj) &&
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
(typeof obj.nodeType != 'number') &&
|
|
43
|
-
(
|
|
44
|
-
// a real array
|
|
45
|
-
(// HTMLCollection/NodeList
|
|
46
|
-
(Array.isArray(obj) ||
|
|
47
|
-
// arguments
|
|
48
|
-
('callee' in obj) || 'item' in obj))
|
|
49
|
-
)
|
|
37
|
+
!('setInterval' in obj) && typeof obj.nodeType != 'number' && (
|
|
38
|
+
// a real array
|
|
39
|
+
(Array.isArray(obj) || 'callee' in obj || 'item' in obj))
|
|
50
40
|
);
|
|
51
41
|
}
|
|
52
42
|
|
|
@@ -82,3 +72,14 @@ function createArrayFromMixed(obj) {
|
|
|
82
72
|
}
|
|
83
73
|
|
|
84
74
|
module.exports = createArrayFromMixed;
|
|
75
|
+
|
|
76
|
+
// arrays are objects, NodeLists are functions in Safari
|
|
77
|
+
|
|
78
|
+
// quacks like an array
|
|
79
|
+
|
|
80
|
+
// no DOM node should be considered an array-like
|
|
81
|
+
// a 'select' element has 'length' and 'item' properties on IE8
|
|
82
|
+
|
|
83
|
+
// arguments
|
|
84
|
+
|
|
85
|
+
// HTMLCollection/NodeList
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
/*jslint evil: true, sub: true */
|
|
14
14
|
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
15
17
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
16
18
|
|
|
17
19
|
var createArrayFromMixed = require("./createArrayFromMixed");
|
|
@@ -21,8 +23,7 @@ var invariant = require("./invariant");
|
|
|
21
23
|
/**
|
|
22
24
|
* Dummy container used to render all markup.
|
|
23
25
|
*/
|
|
24
|
-
var dummyNode =
|
|
25
|
-
ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
|
26
|
+
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Pattern used by `getNodeName`.
|
|
@@ -52,7 +53,7 @@ function getNodeName(markup) {
|
|
|
52
53
|
*/
|
|
53
54
|
function createNodesFromMarkup(markup, handleScript) {
|
|
54
55
|
var node = dummyNode;
|
|
55
|
-
|
|
56
|
+
!!!dummyNode ? 'production' !== process.env.NODE_ENV ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
|
|
56
57
|
var nodeName = getNodeName(markup);
|
|
57
58
|
|
|
58
59
|
var wrap = nodeName && getMarkupWrap(nodeName);
|
|
@@ -69,10 +70,7 @@ function createNodesFromMarkup(markup, handleScript) {
|
|
|
69
70
|
|
|
70
71
|
var scripts = node.getElementsByTagName('script');
|
|
71
72
|
if (scripts.length) {
|
|
72
|
-
|
|
73
|
-
handleScript,
|
|
74
|
-
'createNodesFromMarkup(...): Unexpected <script> element rendered.'
|
|
75
|
-
) : invariant(handleScript));
|
|
73
|
+
!handleScript ? 'production' !== process.env.NODE_ENV ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
|
|
76
74
|
createArrayFromMixed(scripts).forEach(handleScript);
|
|
77
75
|
}
|
|
78
76
|
|
|
@@ -83,4 +81,4 @@ function createNodesFromMarkup(markup, handleScript) {
|
|
|
83
81
|
return nodes;
|
|
84
82
|
}
|
|
85
83
|
|
|
86
|
-
module.exports = createNodesFromMarkup;
|
|
84
|
+
module.exports = createNodesFromMarkup;
|
|
@@ -42,8 +42,7 @@ function dangerousStyleValue(name, value) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
var isNonNumeric = isNaN(value);
|
|
45
|
-
if (isNonNumeric || value === 0 ||
|
|
46
|
-
isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
|
|
45
|
+
if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
|
|
47
46
|
return '' + value; // cast to string
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -53,4 +52,4 @@ function dangerousStyleValue(name, value) {
|
|
|
53
52
|
return value + 'px';
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
module.exports = dangerousStyleValue;
|
|
55
|
+
module.exports = dangerousStyleValue;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule deprecated
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var assign = require("./Object.assign");
|
|
15
|
+
var warning = require("./warning");
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This will log a single deprecation notice per function and forward the call
|
|
19
|
+
* on to the new API.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} fnName The name of the function
|
|
22
|
+
* @param {string} newModule The module that fn will exist in
|
|
23
|
+
* @param {*} ctx The context this forwarded call should run in
|
|
24
|
+
* @param {function} fn The function to forward on to
|
|
25
|
+
* @return {function} The function that will warn once and then call fn
|
|
26
|
+
*/
|
|
27
|
+
function deprecated(fnName, newModule, ctx, fn) {
|
|
28
|
+
var warned = false;
|
|
29
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
30
|
+
var newFn = function () {
|
|
31
|
+
'production' !== process.env.NODE_ENV ? warning(warned,
|
|
32
|
+
// Require examples in this string must be split to prevent React's
|
|
33
|
+
// build tools from mistaking them for real requires.
|
|
34
|
+
// Otherwise the build tools will attempt to build a '%s' module.
|
|
35
|
+
'`require' + '("react").%s` is deprecated. Please use `require' + '("%s").%s` ' + 'instead.', fnName, newModule, fnName) : undefined;
|
|
36
|
+
warned = true;
|
|
37
|
+
return fn.apply(ctx, arguments);
|
|
38
|
+
};
|
|
39
|
+
// We need to make sure all properties of the original fn are copied over.
|
|
40
|
+
// In particular, this is needed to support PropTypes
|
|
41
|
+
return assign(newFn, fn);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return fn;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = deprecated;
|
package/lib/emptyFunction.js
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* @providesModule emptyFunction
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
12
14
|
function makeEmptyFunction(arg) {
|
|
13
|
-
return function() {
|
|
15
|
+
return function () {
|
|
14
16
|
return arg;
|
|
15
17
|
};
|
|
16
18
|
}
|
|
@@ -26,7 +28,11 @@ emptyFunction.thatReturns = makeEmptyFunction;
|
|
|
26
28
|
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
27
29
|
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
28
30
|
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
29
|
-
emptyFunction.thatReturnsThis = function() {
|
|
30
|
-
|
|
31
|
+
emptyFunction.thatReturnsThis = function () {
|
|
32
|
+
return this;
|
|
33
|
+
};
|
|
34
|
+
emptyFunction.thatReturnsArgument = function (arg) {
|
|
35
|
+
return arg;
|
|
36
|
+
};
|
|
31
37
|
|
|
32
|
-
module.exports = emptyFunction;
|
|
38
|
+
module.exports = emptyFunction;
|
package/lib/emptyObject.js
CHANGED
package/lib/findDOMNode.js
CHANGED
|
@@ -17,53 +17,33 @@ var ReactInstanceMap = require("./ReactInstanceMap");
|
|
|
17
17
|
var ReactMount = require("./ReactMount");
|
|
18
18
|
|
|
19
19
|
var invariant = require("./invariant");
|
|
20
|
-
var isNode = require("./isNode");
|
|
21
20
|
var warning = require("./warning");
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Returns the DOM node rendered by this element.
|
|
25
24
|
*
|
|
26
25
|
* @param {ReactComponent|DOMElement} componentOrElement
|
|
27
|
-
* @return {DOMElement} The root node of this element.
|
|
26
|
+
* @return {?DOMElement} The root node of this element.
|
|
28
27
|
*/
|
|
29
28
|
function findDOMNode(componentOrElement) {
|
|
30
|
-
if (
|
|
29
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
31
30
|
var owner = ReactCurrentOwner.current;
|
|
32
31
|
if (owner !== null) {
|
|
33
|
-
|
|
34
|
-
owner._warnedAboutRefsInRender,
|
|
35
|
-
'%s is accessing getDOMNode or findDOMNode inside its render(). ' +
|
|
36
|
-
'render() should be a pure function of props and state. It should ' +
|
|
37
|
-
'never access something that requires stale data from the previous ' +
|
|
38
|
-
'render, such as refs. Move this logic to componentDidMount and ' +
|
|
39
|
-
'componentDidUpdate instead.',
|
|
40
|
-
owner.getName() || 'A component'
|
|
41
|
-
) : null);
|
|
32
|
+
'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;
|
|
42
33
|
owner._warnedAboutRefsInRender = true;
|
|
43
34
|
}
|
|
44
35
|
}
|
|
45
36
|
if (componentOrElement == null) {
|
|
46
37
|
return null;
|
|
47
38
|
}
|
|
48
|
-
if (
|
|
39
|
+
if (componentOrElement.nodeType === 1) {
|
|
49
40
|
return componentOrElement;
|
|
50
41
|
}
|
|
51
42
|
if (ReactInstanceMap.has(componentOrElement)) {
|
|
52
43
|
return ReactMount.getNodeFromInstance(componentOrElement);
|
|
53
44
|
}
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
typeof componentOrElement.render !== 'function',
|
|
57
|
-
'Component (with keys: %s) contains `render` method ' +
|
|
58
|
-
'but is not mounted in the DOM',
|
|
59
|
-
Object.keys(componentOrElement)
|
|
60
|
-
) : invariant(componentOrElement.render == null ||
|
|
61
|
-
typeof componentOrElement.render !== 'function'));
|
|
62
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
63
|
-
false,
|
|
64
|
-
'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
|
|
65
|
-
Object.keys(componentOrElement)
|
|
66
|
-
) : invariant(false));
|
|
45
|
+
!(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;
|
|
46
|
+
!false ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
|
|
67
47
|
}
|
|
68
48
|
|
|
69
|
-
module.exports = findDOMNode;
|
|
49
|
+
module.exports = findDOMNode;
|