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/keyMirror.js
CHANGED
|
@@ -35,7 +35,7 @@ var invariant = require("./invariant");
|
|
|
35
35
|
var keyMirror = function (obj) {
|
|
36
36
|
var ret = {};
|
|
37
37
|
var key;
|
|
38
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
38
|
+
!(obj instanceof Object && !Array.isArray(obj)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
|
|
39
39
|
for (key in obj) {
|
|
40
40
|
if (!obj.hasOwnProperty(key)) {
|
|
41
41
|
continue;
|
package/lib/onlyChild.js
CHANGED
|
@@ -26,7 +26,7 @@ var invariant = require("./invariant");
|
|
|
26
26
|
* structure.
|
|
27
27
|
*/
|
|
28
28
|
function onlyChild(children) {
|
|
29
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
29
|
+
!ReactElement.isValidElement(children) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
|
|
30
30
|
return children;
|
|
31
31
|
}
|
|
32
32
|
|
package/lib/toArray.js
CHANGED
|
@@ -28,11 +28,11 @@ function toArray(obj) {
|
|
|
28
28
|
|
|
29
29
|
// Some browse builtin objects can report typeof 'function' (e.g. NodeList in
|
|
30
30
|
// old versions of Safari).
|
|
31
|
-
|
|
31
|
+
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
|
|
32
32
|
|
|
33
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
33
|
+
!(typeof length === 'number') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
!(length === 0 || length - 1 in obj) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
|
|
36
36
|
|
|
37
37
|
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
|
|
38
38
|
// without method will throw during the slice call and skip straight to the
|
|
@@ -126,7 +126,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
126
126
|
}
|
|
127
127
|
} else {
|
|
128
128
|
if ('production' !== process.env.NODE_ENV) {
|
|
129
|
-
'production' !== process.env.NODE_ENV ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') :
|
|
129
|
+
'production' !== process.env.NODE_ENV ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
|
|
130
130
|
didWarnAboutMaps = true;
|
|
131
131
|
}
|
|
132
132
|
// Iterator will provide entry [k,v] tuples rather than values.
|
|
@@ -140,7 +140,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
} else if (type === 'object') {
|
|
143
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
143
|
+
!(children.nodeType !== 1) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseAllChildren(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
|
|
144
144
|
var fragment = ReactFragment.extract(children);
|
|
145
145
|
for (var key in fragment) {
|
|
146
146
|
if (fragment.hasOwnProperty(key)) {
|
package/lib/update.js
CHANGED
|
@@ -44,16 +44,16 @@ ALL_COMMANDS_LIST.forEach(function (command) {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
function invariantArrayCase(value, spec, command) {
|
|
47
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
47
|
+
!Array.isArray(value) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
|
|
48
48
|
var specValue = spec[command];
|
|
49
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
49
|
+
!Array.isArray(specValue) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function update(value, spec) {
|
|
53
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
53
|
+
!(typeof spec === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
|
|
54
54
|
|
|
55
55
|
if (hasOwnProperty.call(spec, COMMAND_SET)) {
|
|
56
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
56
|
+
!(Object.keys(spec).length === 1) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
|
|
57
57
|
|
|
58
58
|
return spec[COMMAND_SET];
|
|
59
59
|
}
|
|
@@ -62,8 +62,8 @@ function update(value, spec) {
|
|
|
62
62
|
|
|
63
63
|
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
|
|
64
64
|
var mergeObj = spec[COMMAND_MERGE];
|
|
65
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
66
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
65
|
+
!(mergeObj && typeof mergeObj === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
|
|
66
|
+
!(nextValue && typeof nextValue === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
|
|
67
67
|
assign(nextValue, spec[COMMAND_MERGE]);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -82,16 +82,16 @@ function update(value, spec) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
|
|
85
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
86
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
85
|
+
!Array.isArray(value) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
|
|
86
|
+
!Array.isArray(spec[COMMAND_SPLICE]) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
|
|
87
87
|
spec[COMMAND_SPLICE].forEach(function (args) {
|
|
88
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
88
|
+
!Array.isArray(args) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
|
|
89
89
|
nextValue.splice.apply(nextValue, args);
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
|
|
94
|
-
'production' !== process.env.NODE_ENV ? invariant(
|
|
94
|
+
!(typeof spec[COMMAND_APPLY] === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
|
|
95
95
|
nextValue = spec[COMMAND_APPLY](nextValue);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -282,6 +282,8 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
282
282
|
return stack;
|
|
283
283
|
};
|
|
284
284
|
|
|
285
|
+
var didWarn = {};
|
|
286
|
+
|
|
285
287
|
validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
|
|
286
288
|
ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
|
287
289
|
var parentInfo = ancestorInfo.parentTag;
|
|
@@ -327,14 +329,20 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
327
329
|
// If we're warning about an invalid (non-parent) ancestry, add '...'
|
|
328
330
|
invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
|
|
329
331
|
|
|
332
|
+
var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
|
|
333
|
+
if (didWarn[warnKey]) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
didWarn[warnKey] = true;
|
|
337
|
+
|
|
330
338
|
if (invalidParent) {
|
|
331
339
|
var info = '';
|
|
332
340
|
if (ancestorTag === 'table' && childTag === 'tr') {
|
|
333
341
|
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
|
|
334
342
|
}
|
|
335
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) :
|
|
343
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
|
|
336
344
|
} else {
|
|
337
|
-
'production' !== process.env.NODE_ENV ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) :
|
|
345
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
|
|
338
346
|
}
|
|
339
347
|
}
|
|
340
348
|
};
|