react 0.13.0-rc1 → 0.13.2
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 +955 -1017
- package/dist/react-with-addons.js +201 -73
- package/dist/react-with-addons.min.js +7 -6
- package/dist/react.js +190 -65
- package/dist/react.min.js +5 -5
- package/lib/CSSProperty.js +5 -1
- package/lib/HTMLDOMPropertyConfig.js +7 -1
- package/lib/React.js +4 -1
- package/lib/ReactComponent.js +2 -1
- package/lib/ReactCompositeComponent.js +29 -5
- package/lib/ReactDOMComponent.js +3 -0
- package/lib/ReactDOMSelect.js +3 -1
- package/lib/ReactDefaultPerf.js +8 -11
- package/lib/ReactElement.js +54 -0
- package/lib/ReactElementValidator.js +64 -38
- package/lib/ReactFragment.js +2 -1
- package/lib/ReactPropTypes.js +4 -1
- package/lib/ReactReconciler.js +0 -1
- package/lib/ReactRef.js +1 -1
- package/lib/ReactTestUtils.js +1 -1
- package/lib/cloneWithProps.js +1 -1
- package/lib/createFullPageComponent.js +1 -0
- package/lib/instantiateReactComponent.js +1 -0
- package/lib/update.js +9 -6
- package/package.json +1 -1
package/lib/ReactFragment.js
CHANGED
|
@@ -141,7 +141,8 @@ var ReactFragment = {
|
|
|
141
141
|
("production" !== process.env.NODE_ENV ? warning(
|
|
142
142
|
didWarnForFragment(fragment),
|
|
143
143
|
'Any use of a keyed object should be wrapped in ' +
|
|
144
|
-
'React.addons.createFragment(object) before passed as a
|
|
144
|
+
'React.addons.createFragment(object) before being passed as a ' +
|
|
145
|
+
'child.'
|
|
145
146
|
) : null);
|
|
146
147
|
return fragment;
|
|
147
148
|
}
|
package/lib/ReactPropTypes.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactElement = require("./ReactElement");
|
|
15
|
+
var ReactFragment = require("./ReactFragment");
|
|
15
16
|
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
|
|
16
17
|
|
|
17
18
|
var emptyFunction = require("./emptyFunction");
|
|
@@ -291,6 +292,7 @@ function isNode(propValue) {
|
|
|
291
292
|
switch (typeof propValue) {
|
|
292
293
|
case 'number':
|
|
293
294
|
case 'string':
|
|
295
|
+
case 'undefined':
|
|
294
296
|
return true;
|
|
295
297
|
case 'boolean':
|
|
296
298
|
return !propValue;
|
|
@@ -298,9 +300,10 @@ function isNode(propValue) {
|
|
|
298
300
|
if (Array.isArray(propValue)) {
|
|
299
301
|
return propValue.every(isNode);
|
|
300
302
|
}
|
|
301
|
-
if (ReactElement.isValidElement(propValue)) {
|
|
303
|
+
if (propValue === null || ReactElement.isValidElement(propValue)) {
|
|
302
304
|
return true;
|
|
303
305
|
}
|
|
306
|
+
propValue = ReactFragment.extractIfFragment(propValue);
|
|
304
307
|
for (var k in propValue) {
|
|
305
308
|
if (!isNode(propValue[k])) {
|
|
306
309
|
return false;
|
package/lib/ReactReconciler.js
CHANGED
package/lib/ReactRef.js
CHANGED
|
@@ -40,7 +40,7 @@ ReactRef.attachRefs = function(instance, element) {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
ReactRef.shouldUpdateRefs = function(
|
|
43
|
+
ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
|
|
44
44
|
// If either the owner or a `ref` has changed, make sure the newest owner
|
|
45
45
|
// has stored a reference to `this`, and the previous owner (if different)
|
|
46
46
|
// has forgotten the reference to `this`. We use the element instead
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -65,7 +65,7 @@ var ReactTestUtils = {
|
|
|
65
65
|
isDOMComponent: function(inst) {
|
|
66
66
|
// TODO: Fix this heuristic. It's just here because composites can currently
|
|
67
67
|
// pretend to be DOM components.
|
|
68
|
-
return !!(inst && inst.
|
|
68
|
+
return !!(inst && inst.tagName && inst.getDOMNode);
|
|
69
69
|
},
|
|
70
70
|
|
|
71
71
|
isDOMComponentElement: function(inst) {
|
package/lib/cloneWithProps.js
CHANGED
|
@@ -33,6 +33,7 @@ function createFullPageComponent(tag) {
|
|
|
33
33
|
var elementFactory = ReactElement.createFactory(tag);
|
|
34
34
|
|
|
35
35
|
var FullPageComponent = ReactClass.createClass({
|
|
36
|
+
tagName: tag.toUpperCase(),
|
|
36
37
|
displayName: 'ReactFullPageComponent' + tag,
|
|
37
38
|
|
|
38
39
|
componentWillUnmount: function() {
|
package/lib/update.js
CHANGED
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
* @providesModule update
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/* global hasOwnProperty:true */
|
|
13
|
+
|
|
12
14
|
'use strict';
|
|
13
15
|
|
|
14
16
|
var assign = require("./Object.assign");
|
|
15
17
|
var keyOf = require("./keyOf");
|
|
16
18
|
var invariant = require("./invariant");
|
|
19
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
17
20
|
|
|
18
21
|
function shallowCopy(x) {
|
|
19
22
|
if (Array.isArray(x)) {
|
|
@@ -73,7 +76,7 @@ function update(value, spec) {
|
|
|
73
76
|
COMMAND_SET
|
|
74
77
|
) : invariant(typeof spec === 'object'));
|
|
75
78
|
|
|
76
|
-
if (
|
|
79
|
+
if (hasOwnProperty.call(spec, COMMAND_SET)) {
|
|
77
80
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
78
81
|
Object.keys(spec).length === 1,
|
|
79
82
|
'Cannot have more than one key in an object with %s',
|
|
@@ -85,7 +88,7 @@ function update(value, spec) {
|
|
|
85
88
|
|
|
86
89
|
var nextValue = shallowCopy(value);
|
|
87
90
|
|
|
88
|
-
if (
|
|
91
|
+
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
|
|
89
92
|
var mergeObj = spec[COMMAND_MERGE];
|
|
90
93
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
91
94
|
mergeObj && typeof mergeObj === 'object',
|
|
@@ -102,21 +105,21 @@ function update(value, spec) {
|
|
|
102
105
|
assign(nextValue, spec[COMMAND_MERGE]);
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
if (
|
|
108
|
+
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
|
|
106
109
|
invariantArrayCase(value, spec, COMMAND_PUSH);
|
|
107
110
|
spec[COMMAND_PUSH].forEach(function(item) {
|
|
108
111
|
nextValue.push(item);
|
|
109
112
|
});
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
if (
|
|
115
|
+
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
|
|
113
116
|
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
|
|
114
117
|
spec[COMMAND_UNSHIFT].forEach(function(item) {
|
|
115
118
|
nextValue.unshift(item);
|
|
116
119
|
});
|
|
117
120
|
}
|
|
118
121
|
|
|
119
|
-
if (
|
|
122
|
+
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
|
|
120
123
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
121
124
|
Array.isArray(value),
|
|
122
125
|
'Expected %s target to be an array; got %s',
|
|
@@ -142,7 +145,7 @@ function update(value, spec) {
|
|
|
142
145
|
});
|
|
143
146
|
}
|
|
144
147
|
|
|
145
|
-
if (
|
|
148
|
+
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
|
|
146
149
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
147
150
|
typeof spec[COMMAND_APPLY] === 'function',
|
|
148
151
|
'update(): expected spec of %s to be a function; got %s.',
|