react 0.13.0 → 0.14.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/addons.js +7 -0
- package/addons/CSSTransitionGroup.js +1 -0
- package/addons/LinkedStateMixin.js +1 -0
- package/addons/Perf.js +1 -0
- package/addons/PureRenderMixin.js +1 -0
- package/addons/TestUtils.js +1 -0
- package/addons/TransitionGroup.js +1 -0
- package/addons/batchedUpdates.js +1 -0
- package/addons/cloneWithProps.js +1 -0
- package/addons/createFragment.js +1 -0
- package/addons/renderSubtreeIntoContainer.js +1 -0
- package/addons/shallowCompare.js +1 -0
- package/addons/update.js +1 -0
- package/dist/JSXTransformer.js +3336 -1671
- package/dist/react-with-addons.js +3134 -5113
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +2812 -4567
- package/dist/react.min.js +5 -5
- package/lib/AutoFocusMixin.js +4 -3
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +9 -4
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +24 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +41 -65
- package/lib/DOMPropertyOperations.js +30 -51
- package/lib/Danger.js +19 -60
- 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 +27 -38
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +12 -18
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +34 -64
- package/lib/LocalEventTrapMixin.js +9 -16
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +8 -11
- package/lib/React.js +20 -38
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +18 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +7 -16
- package/lib/ReactClass.js +78 -231
- package/lib/ReactComponent.js +17 -33
- package/lib/ReactComponentBrowserEnvironment.js +4 -6
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +4 -5
- package/lib/ReactCompositeComponent.js +85 -297
- package/lib/ReactContext.js +2 -44
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +3 -4
- package/lib/ReactDOMComponent.js +185 -146
- package/lib/ReactDOMForm.js +3 -3
- package/lib/ReactDOMIDOperations.js +11 -20
- package/lib/ReactDOMIframe.js +3 -3
- package/lib/ReactDOMImg.js +3 -3
- package/lib/ReactDOMInput.js +22 -35
- package/lib/ReactDOMOption.js +52 -10
- package/lib/ReactDOMSelect.js +53 -29
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +15 -27
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +21 -40
- package/lib/ReactDefaultPerf.js +41 -72
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +35 -72
- package/lib/ReactElementValidator.js +51 -110
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +2 -2
- package/lib/ReactEventEmitterMixin.js +3 -12
- package/lib/ReactEventListener.js +16 -38
- package/lib/ReactFragment.js +23 -54
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +11 -21
- package/lib/ReactInstanceHandles.js +27 -57
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactLifeCycle.js +1 -1
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +136 -260
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +7 -11
- 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 +13 -46
- package/lib/ReactReconcileTransaction.js +9 -34
- package/lib/ReactReconciler.js +9 -19
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerRendering.js +7 -15
- package/lib/ReactServerRenderingTransaction.js +7 -32
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +94 -166
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +27 -90
- package/lib/ReactUpdates.js +27 -79
- package/lib/ReactWithAddons.js +7 -6
- package/lib/SVGDOMPropertyConfig.js +41 -2
- package/lib/SelectEventPlugin.js +28 -29
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +136 -128
- package/lib/SyntheticClipboardEvent.js +3 -7
- package/lib/SyntheticCompositionEvent.js +3 -9
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +8 -10
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +3 -9
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +8 -14
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +3 -3
- package/lib/SyntheticWheelEvent.js +11 -15
- package/lib/Transaction.js +12 -24
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -2
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +5 -11
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createFullPageComponent.js +5 -11
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +5 -24
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +2 -2
- package/lib/getActiveElement.js +4 -2
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +2 -4
- package/lib/getMarkupWrap.js +7 -5
- 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 +14 -37
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +2 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +2 -2
- 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 +19 -82
- package/lib/update.js +33 -90
- package/lib/validateDOMNesting.js +264 -0
- package/lib/warning.js +17 -15
- package/package.json +3 -3
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactPutListenerQueue.js +0 -54
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
package/lib/getMarkupWrap.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* @providesModule getMarkupWrap
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
12
14
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
13
15
|
|
|
14
16
|
var invariant = require("./invariant");
|
|
@@ -16,8 +18,7 @@ var invariant = require("./invariant");
|
|
|
16
18
|
/**
|
|
17
19
|
* Dummy container used to detect which wraps are necessary.
|
|
18
20
|
*/
|
|
19
|
-
var dummyNode =
|
|
20
|
-
ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
|
21
|
+
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Some browsers cannot use `innerHTML` to render certain elements standalone,
|
|
@@ -29,6 +30,7 @@ var shouldWrap = {
|
|
|
29
30
|
// Force wrapping for SVG elements because if they get created inside a <div>,
|
|
30
31
|
// they will be initialized in the wrong namespace (and will not display).
|
|
31
32
|
'circle': true,
|
|
33
|
+
'clipPath': true,
|
|
32
34
|
'defs': true,
|
|
33
35
|
'ellipse': true,
|
|
34
36
|
'g': true,
|
|
@@ -71,6 +73,7 @@ var markupWrap = {
|
|
|
71
73
|
'th': trWrap,
|
|
72
74
|
|
|
73
75
|
'circle': svgWrap,
|
|
76
|
+
'clipPath': svgWrap,
|
|
74
77
|
'defs': svgWrap,
|
|
75
78
|
'ellipse': svgWrap,
|
|
76
79
|
'g': svgWrap,
|
|
@@ -94,7 +97,7 @@ var markupWrap = {
|
|
|
94
97
|
* @return {?array} Markup wrap configuration, if applicable.
|
|
95
98
|
*/
|
|
96
99
|
function getMarkupWrap(nodeName) {
|
|
97
|
-
|
|
100
|
+
'production' !== process.env.NODE_ENV ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode);
|
|
98
101
|
if (!markupWrap.hasOwnProperty(nodeName)) {
|
|
99
102
|
nodeName = '*';
|
|
100
103
|
}
|
|
@@ -109,5 +112,4 @@ function getMarkupWrap(nodeName) {
|
|
|
109
112
|
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
module.exports = getMarkupWrap;
|
|
115
|
+
module.exports = getMarkupWrap;
|
|
@@ -25,11 +25,9 @@ function getTextContentAccessor() {
|
|
|
25
25
|
if (!contentKey && ExecutionEnvironment.canUseDOM) {
|
|
26
26
|
// Prefer textContent to innerText because many browsers support both but
|
|
27
27
|
// SVG <text> elements don't support innerText even when <div> does.
|
|
28
|
-
contentKey = 'textContent' in document.documentElement ?
|
|
29
|
-
'textContent' :
|
|
30
|
-
'innerText';
|
|
28
|
+
contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
|
|
31
29
|
}
|
|
32
30
|
return contentKey;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
module.exports = getTextContentAccessor;
|
|
33
|
+
module.exports = getTextContentAccessor;
|
package/lib/hyphenate.js
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
13
15
|
var _uppercasePattern = /([A-Z])/g;
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -28,4 +30,4 @@ function hyphenate(string) {
|
|
|
28
30
|
return string.replace(_uppercasePattern, '-$1').toLowerCase();
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
module.exports = hyphenate;
|
|
33
|
+
module.exports = hyphenate;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var hyphenate = require("./hyphenate");
|
|
16
16
|
|
|
@@ -36,4 +36,4 @@ function hyphenateStyleName(string) {
|
|
|
36
36
|
return hyphenate(string).replace(msPattern, '-ms-');
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
module.exports = hyphenateStyleName;
|
|
39
|
+
module.exports = hyphenateStyleName;
|
|
@@ -21,14 +21,10 @@ var invariant = require("./invariant");
|
|
|
21
21
|
var warning = require("./warning");
|
|
22
22
|
|
|
23
23
|
// To avoid a cyclic dependency, we create the final class in this module
|
|
24
|
-
var ReactCompositeComponentWrapper = function() {
|
|
25
|
-
assign(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
_instantiateReactComponent: instantiateReactComponent
|
|
30
|
-
}
|
|
31
|
-
);
|
|
24
|
+
var ReactCompositeComponentWrapper = function () {};
|
|
25
|
+
assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
|
|
26
|
+
_instantiateReactComponent: instantiateReactComponent
|
|
27
|
+
});
|
|
32
28
|
|
|
33
29
|
/**
|
|
34
30
|
* Check if the type reference is a known internal type. I.e. not a user
|
|
@@ -38,11 +34,7 @@ assign(
|
|
|
38
34
|
* @return {boolean} Returns true if this is a valid internal type.
|
|
39
35
|
*/
|
|
40
36
|
function isInternalComponentType(type) {
|
|
41
|
-
return
|
|
42
|
-
typeof type === 'function' &&
|
|
43
|
-
typeof type.prototype.mountComponent === 'function' &&
|
|
44
|
-
typeof type.prototype.receiveComponent === 'function'
|
|
45
|
-
);
|
|
37
|
+
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
/**
|
|
@@ -62,17 +54,12 @@ function instantiateReactComponent(node, parentCompositeType) {
|
|
|
62
54
|
|
|
63
55
|
if (typeof node === 'object') {
|
|
64
56
|
var element = node;
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
element && (typeof element.type === 'function' ||
|
|
68
|
-
typeof element.type === 'string'),
|
|
69
|
-
'Only functions or strings can be mounted as React components.'
|
|
70
|
-
) : null);
|
|
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.') : null;
|
|
71
59
|
}
|
|
72
60
|
|
|
73
61
|
// Special case string values
|
|
74
|
-
if (parentCompositeType === element.type &&
|
|
75
|
-
typeof element.type === 'string') {
|
|
62
|
+
if (parentCompositeType === element.type && typeof element.type === 'string') {
|
|
76
63
|
// Avoid recursion if the wrapper renders itself.
|
|
77
64
|
instance = ReactNativeComponent.createInternalComponent(element);
|
|
78
65
|
// All native components are currently wrapped in a composite so we're
|
|
@@ -88,21 +75,11 @@ function instantiateReactComponent(node, parentCompositeType) {
|
|
|
88
75
|
} else if (typeof node === 'string' || typeof node === 'number') {
|
|
89
76
|
instance = ReactNativeComponent.createInstanceForText(node);
|
|
90
77
|
} else {
|
|
91
|
-
|
|
92
|
-
false,
|
|
93
|
-
'Encountered invalid React node of type %s',
|
|
94
|
-
typeof node
|
|
95
|
-
) : invariant(false));
|
|
78
|
+
'production' !== process.env.NODE_ENV ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false);
|
|
96
79
|
}
|
|
97
80
|
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
typeof instance.construct === 'function' &&
|
|
101
|
-
typeof instance.mountComponent === 'function' &&
|
|
102
|
-
typeof instance.receiveComponent === 'function' &&
|
|
103
|
-
typeof instance.unmountComponent === 'function',
|
|
104
|
-
'Only React Components can be mounted.'
|
|
105
|
-
) : null);
|
|
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.') : null;
|
|
106
83
|
}
|
|
107
84
|
|
|
108
85
|
// Sets up the instance. This can probably just move into the constructor now.
|
|
@@ -114,14 +91,14 @@ function instantiateReactComponent(node, parentCompositeType) {
|
|
|
114
91
|
instance._mountIndex = 0;
|
|
115
92
|
instance._mountImage = null;
|
|
116
93
|
|
|
117
|
-
if (
|
|
94
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
118
95
|
instance._isOwnerNecessary = false;
|
|
119
96
|
instance._warnedAboutRefsInRender = false;
|
|
120
97
|
}
|
|
121
98
|
|
|
122
99
|
// Internal instances should fully constructed at this point, so they should
|
|
123
100
|
// not get any new fields added to them at this point.
|
|
124
|
-
if (
|
|
101
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
125
102
|
if (Object.preventExtensions) {
|
|
126
103
|
Object.preventExtensions(instance);
|
|
127
104
|
}
|
|
@@ -130,4 +107,4 @@ function instantiateReactComponent(node, parentCompositeType) {
|
|
|
130
107
|
return instance;
|
|
131
108
|
}
|
|
132
109
|
|
|
133
|
-
module.exports = instantiateReactComponent;
|
|
110
|
+
module.exports = instantiateReactComponent;
|
package/lib/invariant.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule invariant
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Use invariant() to assert state which your program assumes to be true.
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
* will remain to ensure logic does not differ in production.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
var invariant = function(condition, format, a, b, c, d, e, f) {
|
|
26
|
-
if (
|
|
25
|
+
var invariant = function (condition, format, a, b, c, d, e, f) {
|
|
26
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
27
27
|
if (format === undefined) {
|
|
28
28
|
throw new Error('invariant requires an error message argument');
|
|
29
29
|
}
|
|
@@ -32,17 +32,13 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
|
|
|
32
32
|
if (!condition) {
|
|
33
33
|
var error;
|
|
34
34
|
if (format === undefined) {
|
|
35
|
-
error = new Error(
|
|
36
|
-
'Minified exception occurred; use the non-minified dev environment ' +
|
|
37
|
-
'for the full error message and additional helpful warnings.'
|
|
38
|
-
);
|
|
35
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
39
36
|
} else {
|
|
40
37
|
var args = [a, b, c, d, e, f];
|
|
41
38
|
var argIndex = 0;
|
|
42
|
-
error = new Error(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
39
|
+
error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () {
|
|
40
|
+
return args[argIndex++];
|
|
41
|
+
}));
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
@@ -50,4 +46,4 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
|
|
|
50
46
|
}
|
|
51
47
|
};
|
|
52
48
|
|
|
53
|
-
module.exports = invariant;
|
|
49
|
+
module.exports = invariant;
|
package/lib/isEventSupported.js
CHANGED
|
@@ -15,12 +15,10 @@ var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
|
15
15
|
|
|
16
16
|
var useHasFeature;
|
|
17
17
|
if (ExecutionEnvironment.canUseDOM) {
|
|
18
|
-
useHasFeature =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
|
|
23
|
-
document.implementation.hasFeature('', '') !== true;
|
|
18
|
+
useHasFeature = document.implementation && document.implementation.hasFeature &&
|
|
19
|
+
// always returns true in newer browsers as per the standard.
|
|
20
|
+
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
|
|
21
|
+
document.implementation.hasFeature('', '') !== true;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
/**
|
|
@@ -38,13 +36,12 @@ if (ExecutionEnvironment.canUseDOM) {
|
|
|
38
36
|
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
39
37
|
*/
|
|
40
38
|
function isEventSupported(eventNameSuffix, capture) {
|
|
41
|
-
if (!ExecutionEnvironment.canUseDOM ||
|
|
42
|
-
capture && !('addEventListener' in document)) {
|
|
39
|
+
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
|
|
43
40
|
return false;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
var eventName = 'on' + eventNameSuffix;
|
|
47
|
-
var isSupported = eventName in document;
|
|
44
|
+
var isSupported = (eventName in document);
|
|
48
45
|
|
|
49
46
|
if (!isSupported) {
|
|
50
47
|
var element = document.createElement('div');
|
|
@@ -60,4 +57,4 @@ function isEventSupported(eventNameSuffix, capture) {
|
|
|
60
57
|
return isSupported;
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
module.exports = isEventSupported;
|
|
60
|
+
module.exports = isEventSupported;
|
package/lib/isNode.js
CHANGED
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
* @param {*} object The object to check.
|
|
15
15
|
* @return {boolean} Whether or not the object is a DOM node.
|
|
16
16
|
*/
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
17
19
|
function isNode(object) {
|
|
18
|
-
return !!(object && (
|
|
19
|
-
((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
|
|
20
|
-
typeof object.nodeType === 'number' &&
|
|
21
|
-
typeof object.nodeName === 'string'))
|
|
22
|
-
));
|
|
20
|
+
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
module.exports = isNode;
|
|
23
|
+
module.exports = isNode;
|
|
@@ -33,9 +33,7 @@ var supportedInputTypes = {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
function isTextInputElement(elem) {
|
|
36
|
-
return elem && (
|
|
37
|
-
(elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
|
|
38
|
-
);
|
|
36
|
+
return elem && (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA');
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
module.exports = isTextInputElement;
|
|
39
|
+
module.exports = isTextInputElement;
|
package/lib/isTextNode.js
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
13
15
|
var isNode = require("./isNode");
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -20,4 +22,4 @@ function isTextNode(object) {
|
|
|
20
22
|
return isNode(object) && object.nodeType == 3;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
module.exports = isTextNode;
|
|
25
|
+
module.exports = isTextNode;
|
package/lib/joinClasses.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* @param {...?string} classes
|
|
20
20
|
* @return {string}
|
|
21
21
|
*/
|
|
22
|
-
function joinClasses(className/*, ... */) {
|
|
22
|
+
function joinClasses(className /*, ... */) {
|
|
23
23
|
if (!className) {
|
|
24
24
|
className = '';
|
|
25
25
|
}
|
|
@@ -36,4 +36,4 @@ function joinClasses(className/*, ... */) {
|
|
|
36
36
|
return className;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
module.exports = joinClasses;
|
|
39
|
+
module.exports = joinClasses;
|
package/lib/keyMirror.js
CHANGED
|
@@ -32,13 +32,10 @@ var invariant = require("./invariant");
|
|
|
32
32
|
* @param {object} obj
|
|
33
33
|
* @return {object}
|
|
34
34
|
*/
|
|
35
|
-
var keyMirror = function(obj) {
|
|
35
|
+
var keyMirror = function (obj) {
|
|
36
36
|
var ret = {};
|
|
37
37
|
var key;
|
|
38
|
-
|
|
39
|
-
obj instanceof Object && !Array.isArray(obj),
|
|
40
|
-
'keyMirror(...): Argument must be an object.'
|
|
41
|
-
) : invariant(obj instanceof Object && !Array.isArray(obj)));
|
|
38
|
+
'production' !== process.env.NODE_ENV ? invariant(obj instanceof Object && !Array.isArray(obj), 'keyMirror(...): Argument must be an object.') : invariant(obj instanceof Object && !Array.isArray(obj));
|
|
42
39
|
for (key in obj) {
|
|
43
40
|
if (!obj.hasOwnProperty(key)) {
|
|
44
41
|
continue;
|
|
@@ -48,4 +45,4 @@ var keyMirror = function(obj) {
|
|
|
48
45
|
return ret;
|
|
49
46
|
};
|
|
50
47
|
|
|
51
|
-
module.exports = keyMirror;
|
|
48
|
+
module.exports = keyMirror;
|
package/lib/keyOf.js
CHANGED
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
|
|
20
20
|
* reuse those resolutions.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
"use strict";
|
|
23
|
+
|
|
24
|
+
var keyOf = function (oneKeyObj) {
|
|
23
25
|
var key;
|
|
24
26
|
for (key in oneKeyObj) {
|
|
25
27
|
if (!oneKeyObj.hasOwnProperty(key)) {
|
|
@@ -30,5 +32,4 @@ var keyOf = function(oneKeyObj) {
|
|
|
30
32
|
return null;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
module.exports = keyOf;
|
|
35
|
+
module.exports = keyOf;
|
package/lib/mapObject.js
CHANGED
package/lib/memoizeStringOnly.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
function memoizeStringOnly(callback) {
|
|
22
22
|
var cache = {};
|
|
23
|
-
return function(string) {
|
|
23
|
+
return function (string) {
|
|
24
24
|
if (!cache.hasOwnProperty(string)) {
|
|
25
25
|
cache[string] = callback.call(this, string);
|
|
26
26
|
}
|
|
@@ -28,4 +28,4 @@ function memoizeStringOnly(callback) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
module.exports = memoizeStringOnly;
|
|
31
|
+
module.exports = memoizeStringOnly;
|
package/lib/onlyChild.js
CHANGED
|
@@ -26,11 +26,8 @@ var invariant = require("./invariant");
|
|
|
26
26
|
* structure.
|
|
27
27
|
*/
|
|
28
28
|
function onlyChild(children) {
|
|
29
|
-
|
|
30
|
-
ReactElement.isValidElement(children),
|
|
31
|
-
'onlyChild must be passed a children with exactly one child.'
|
|
32
|
-
) : invariant(ReactElement.isValidElement(children)));
|
|
29
|
+
'production' !== process.env.NODE_ENV ? invariant(ReactElement.isValidElement(children), 'onlyChild must be passed a children with exactly one child.') : invariant(ReactElement.isValidElement(children));
|
|
33
30
|
return children;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
module.exports = onlyChild;
|
|
33
|
+
module.exports = onlyChild;
|
package/lib/performance.js
CHANGED
|
@@ -17,10 +17,7 @@ var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
|
17
17
|
var performance;
|
|
18
18
|
|
|
19
19
|
if (ExecutionEnvironment.canUseDOM) {
|
|
20
|
-
performance =
|
|
21
|
-
window.performance ||
|
|
22
|
-
window.msPerformance ||
|
|
23
|
-
window.webkitPerformance;
|
|
20
|
+
performance = window.performance || window.msPerformance || window.webkitPerformance;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
module.exports = performance || {};
|
|
23
|
+
module.exports = performance || {};
|