react 0.14.0-rc1 → 0.14.0
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/react-with-addons.js +586 -403
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +504 -327
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +6 -1
- package/lib/ChangeEventPlugin.js +1 -1
- package/lib/DOMChildrenOperations.js +5 -0
- package/lib/DOMPropertyOperations.js +7 -0
- package/lib/EventPluginHub.js +15 -4
- package/lib/EventPluginUtils.js +10 -5
- package/lib/HTMLDOMPropertyConfig.js +13 -2
- package/lib/ReactBrowserEventEmitter.js +6 -0
- package/lib/ReactClass.js +0 -1
- package/lib/ReactComponent.js +1 -1
- package/lib/ReactCompositeComponent.js +24 -11
- package/lib/ReactDOMComponent.js +64 -13
- package/lib/ReactDOMIDOperations.js +0 -1
- package/lib/ReactDOMInput.js +6 -1
- package/lib/ReactDOMSelection.js +16 -0
- package/lib/ReactDOMTextarea.js +3 -1
- package/lib/ReactDefaultPerf.js +10 -4
- package/lib/ReactDefaultPerfAnalysis.js +7 -1
- package/lib/ReactElement.js +3 -3
- package/lib/ReactElementValidator.js +12 -4
- package/lib/ReactErrorUtils.js +24 -16
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMount.js +9 -2
- package/lib/ReactPropTransferer.js +1 -1
- package/lib/ReactRef.js +1 -2
- package/lib/ReactTestUtils.js +12 -6
- package/lib/ReactVersion.js +1 -1
- package/lib/SyntheticEvent.js +0 -1
- package/lib/createHierarchyRenderer.js +1 -1
- package/lib/getTestDocument.js +4 -11
- package/lib/traverseAllChildren.js +7 -2
- package/package.json +2 -2
- package/dist/react-dom.js +0 -42
- package/dist/react-dom.min.js +0 -12
- package/lib/joinClasses.js +0 -39
- package/lib/memoizeStringOnly.js +0 -31
|
@@ -87,7 +87,6 @@ var ReactDOMIDOperations = {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
|
|
90
|
-
updatePropertyByID: 'updatePropertyByID',
|
|
91
90
|
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
|
|
92
91
|
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
|
|
93
92
|
});
|
package/lib/ReactDOMInput.js
CHANGED
|
@@ -61,7 +61,9 @@ var ReactDOMInput = {
|
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
mountWrapper: function (inst, props) {
|
|
64
|
-
|
|
64
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
65
|
+
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
|
|
66
|
+
}
|
|
65
67
|
|
|
66
68
|
var defaultValue = props.defaultValue;
|
|
67
69
|
inst._wrapperState = {
|
|
@@ -69,7 +71,10 @@ var ReactDOMInput = {
|
|
|
69
71
|
initialValue: defaultValue != null ? defaultValue : null,
|
|
70
72
|
onChange: _handleChange.bind(inst)
|
|
71
73
|
};
|
|
74
|
+
},
|
|
72
75
|
|
|
76
|
+
mountReadyWrapper: function (inst) {
|
|
77
|
+
// Can't be in mountWrapper or else server rendering leaks.
|
|
73
78
|
instancesByReactID[inst._rootNodeID] = inst;
|
|
74
79
|
},
|
|
75
80
|
|
package/lib/ReactDOMSelection.js
CHANGED
|
@@ -76,6 +76,22 @@ function getModernOffsets(node) {
|
|
|
76
76
|
|
|
77
77
|
var currentRange = selection.getRangeAt(0);
|
|
78
78
|
|
|
79
|
+
// In Firefox, range.startContainer and range.endContainer can be "anonymous
|
|
80
|
+
// divs", e.g. the up/down buttons on an <input type="number">. Anonymous
|
|
81
|
+
// divs do not seem to expose properties, triggering a "Permission denied
|
|
82
|
+
// error" if any of its properties are accessed. The only seemingly possible
|
|
83
|
+
// way to avoid erroring is to access a property that typically works for
|
|
84
|
+
// non-anonymous divs and catch any error that may otherwise arise. See
|
|
85
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427
|
|
86
|
+
try {
|
|
87
|
+
/* eslint-disable no-unused-expressions */
|
|
88
|
+
currentRange.startContainer.nodeType;
|
|
89
|
+
currentRange.endContainer.nodeType;
|
|
90
|
+
/* eslint-enable no-unused-expressions */
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
79
95
|
// If the node and offset values are the same, the selection is collapsed.
|
|
80
96
|
// `Selection.isCollapsed` is available natively, but IE sometimes gets
|
|
81
97
|
// this value wrong.
|
package/lib/ReactDOMTextarea.js
CHANGED
|
@@ -58,7 +58,9 @@ var ReactDOMTextarea = {
|
|
|
58
58
|
},
|
|
59
59
|
|
|
60
60
|
mountWrapper: function (inst, props) {
|
|
61
|
-
|
|
61
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
62
|
+
LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
|
|
63
|
+
}
|
|
62
64
|
|
|
63
65
|
var defaultValue = props.defaultValue;
|
|
64
66
|
// TODO (yungsters): Remove support for children content in <textarea>.
|
package/lib/ReactDefaultPerf.js
CHANGED
|
@@ -143,13 +143,14 @@ var ReactDefaultPerf = {
|
|
|
143
143
|
counts: {},
|
|
144
144
|
writes: {},
|
|
145
145
|
displayNames: {},
|
|
146
|
-
totalTime: 0
|
|
146
|
+
totalTime: 0,
|
|
147
|
+
created: {}
|
|
147
148
|
});
|
|
148
149
|
start = performanceNow();
|
|
149
150
|
rv = func.apply(this, args);
|
|
150
151
|
ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
|
|
151
152
|
return rv;
|
|
152
|
-
} else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactDOMIDOperations') {
|
|
153
|
+
} else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
|
|
153
154
|
start = performanceNow();
|
|
154
155
|
rv = func.apply(this, args);
|
|
155
156
|
totalTime = performanceNow() - start;
|
|
@@ -177,13 +178,17 @@ var ReactDefaultPerf = {
|
|
|
177
178
|
});
|
|
178
179
|
} else {
|
|
179
180
|
// basic format
|
|
180
|
-
|
|
181
|
+
var id = args[0];
|
|
182
|
+
if (typeof id === 'object') {
|
|
183
|
+
id = ReactMount.getID(args[0]);
|
|
184
|
+
}
|
|
185
|
+
ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
|
|
181
186
|
}
|
|
182
187
|
return rv;
|
|
183
188
|
} else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
|
|
184
189
|
fnName === '_renderValidatedComponent')) {
|
|
185
190
|
|
|
186
|
-
if (
|
|
191
|
+
if (this._currentElement.type === ReactMount.TopLevelWrapper) {
|
|
187
192
|
return func.apply(this, args);
|
|
188
193
|
}
|
|
189
194
|
|
|
@@ -197,6 +202,7 @@ var ReactDefaultPerf = {
|
|
|
197
202
|
if (isRender) {
|
|
198
203
|
addValue(entry.counts, rootNodeID, 1);
|
|
199
204
|
} else if (isMount) {
|
|
205
|
+
entry.created[rootNodeID] = true;
|
|
200
206
|
mountStack.push(0);
|
|
201
207
|
}
|
|
202
208
|
|
|
@@ -22,7 +22,9 @@ var DOM_OPERATION_TYPES = {
|
|
|
22
22
|
REMOVE_NODE: 'remove',
|
|
23
23
|
SET_MARKUP: 'set innerHTML',
|
|
24
24
|
TEXT_CONTENT: 'set textContent',
|
|
25
|
-
'
|
|
25
|
+
'setValueForProperty': 'update attribute',
|
|
26
|
+
'setValueForAttribute': 'update attribute',
|
|
27
|
+
'deleteValueForProperty': 'remove attribute',
|
|
26
28
|
'dangerouslyReplaceNodeWithMarkupByID': 'replace'
|
|
27
29
|
};
|
|
28
30
|
|
|
@@ -176,6 +178,10 @@ function getUnchangedComponents(measurement) {
|
|
|
176
178
|
break;
|
|
177
179
|
}
|
|
178
180
|
}
|
|
181
|
+
// check if component newly created
|
|
182
|
+
if (measurement.created[id]) {
|
|
183
|
+
isDirty = true;
|
|
184
|
+
}
|
|
179
185
|
if (!isDirty && measurement.counts[id] > 0) {
|
|
180
186
|
cleanComponents[id] = true;
|
|
181
187
|
}
|
package/lib/ReactElement.js
CHANGED
|
@@ -17,7 +17,7 @@ var assign = require('./Object.assign');
|
|
|
17
17
|
|
|
18
18
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
19
19
|
// nor polyfill, then a plain number is used for performance.
|
|
20
|
-
var
|
|
20
|
+
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
21
21
|
|
|
22
22
|
var RESERVED_PROPS = {
|
|
23
23
|
key: true,
|
|
@@ -57,7 +57,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
57
57
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
58
58
|
var element = {
|
|
59
59
|
// This tag allow us to uniquely identify this as a React Element
|
|
60
|
-
$$typeof:
|
|
60
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
61
61
|
|
|
62
62
|
// Built-in properties that belong on the element
|
|
63
63
|
type: type,
|
|
@@ -250,7 +250,7 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
250
250
|
* @final
|
|
251
251
|
*/
|
|
252
252
|
ReactElement.isValidElement = function (object) {
|
|
253
|
-
return typeof object === 'object' && object !== null && object.$$typeof ===
|
|
253
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
module.exports = ReactElement;
|
|
@@ -57,7 +57,7 @@ var loggedTypeFailures = {};
|
|
|
57
57
|
* @param {*} parentType element's parent's type.
|
|
58
58
|
*/
|
|
59
59
|
function validateExplicitKey(element, parentType) {
|
|
60
|
-
if (element._store.validated || element.key != null) {
|
|
60
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
element._store.validated = true;
|
|
@@ -214,9 +214,10 @@ function validatePropTypes(element) {
|
|
|
214
214
|
var ReactElementValidator = {
|
|
215
215
|
|
|
216
216
|
createElement: function (type, props, children) {
|
|
217
|
+
var validType = typeof type === 'string' || typeof type === 'function';
|
|
217
218
|
// We warn in this case but don't throw. We expect the element creation to
|
|
218
219
|
// succeed and there will likely be errors in render.
|
|
219
|
-
process.env.NODE_ENV !== 'production' ? warning(
|
|
220
|
+
process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
|
|
220
221
|
|
|
221
222
|
var element = ReactElement.createElement.apply(this, arguments);
|
|
222
223
|
|
|
@@ -226,8 +227,15 @@ var ReactElementValidator = {
|
|
|
226
227
|
return element;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
231
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
232
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
233
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
234
|
+
// fixed, the key warnings will appear.)
|
|
235
|
+
if (validType) {
|
|
236
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
237
|
+
validateChildKeys(arguments[i], type);
|
|
238
|
+
}
|
|
231
239
|
}
|
|
232
240
|
|
|
233
241
|
validatePropTypes(element);
|
package/lib/ReactErrorUtils.js
CHANGED
|
@@ -14,25 +14,33 @@
|
|
|
14
14
|
|
|
15
15
|
var caughtError = null;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Call a function while guarding against errors that happens within it.
|
|
19
|
+
*
|
|
20
|
+
* @param {?String} name of the guard to use for logging or debugging
|
|
21
|
+
* @param {Function} func The function to invoke
|
|
22
|
+
* @param {*} a First argument
|
|
23
|
+
* @param {*} b Second argument
|
|
24
|
+
*/
|
|
25
|
+
function invokeGuardedCallback(name, func, a, b) {
|
|
26
|
+
try {
|
|
27
|
+
return func(a, b);
|
|
28
|
+
} catch (x) {
|
|
29
|
+
if (caughtError === null) {
|
|
30
|
+
caughtError = x;
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
17
36
|
var ReactErrorUtils = {
|
|
37
|
+
invokeGuardedCallback: invokeGuardedCallback,
|
|
38
|
+
|
|
18
39
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @param {?String} name of the guard to use for logging or debugging
|
|
22
|
-
* @param {Function} func The function to invoke
|
|
23
|
-
* @param {*} a First argument
|
|
24
|
-
* @param {*} b Second argument
|
|
40
|
+
* Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
|
|
41
|
+
* handler are sure to be rethrown by rethrowCaughtError.
|
|
25
42
|
*/
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
return func(a, b);
|
|
29
|
-
} catch (x) {
|
|
30
|
-
if (caughtError === null) {
|
|
31
|
-
caughtError = x;
|
|
32
|
-
}
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
43
|
+
invokeGuardedCallbackWithCatch: invokeGuardedCallback,
|
|
36
44
|
|
|
37
45
|
/**
|
|
38
46
|
* During execution of guarded functions we will capture the first error which
|
|
@@ -15,7 +15,7 @@ var EventPluginHub = require('./EventPluginHub');
|
|
|
15
15
|
|
|
16
16
|
function runEventQueueInBatch(events) {
|
|
17
17
|
EventPluginHub.enqueueEvents(events);
|
|
18
|
-
EventPluginHub.processEventQueue();
|
|
18
|
+
EventPluginHub.processEventQueue(false);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
var ReactEventEmitterMixin = {
|
package/lib/ReactLink.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
|
|
27
27
|
* return <input valueLink={valueLink} />;
|
|
28
28
|
* },
|
|
29
|
-
*
|
|
29
|
+
* _handleValueChange: function(newValue) {
|
|
30
30
|
* this.setState({value: newValue});
|
|
31
31
|
* }
|
|
32
32
|
* });
|
package/lib/ReactMount.js
CHANGED
|
@@ -347,7 +347,11 @@ function findFirstReactDOMImpl(node) {
|
|
|
347
347
|
do {
|
|
348
348
|
lastID = internalGetID(current);
|
|
349
349
|
current = current.parentNode;
|
|
350
|
-
|
|
350
|
+
if (current == null) {
|
|
351
|
+
// The passed-in node has been detached from the container it was
|
|
352
|
+
// originally rendered into.
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
351
355
|
} while (lastID !== reactRootID);
|
|
352
356
|
|
|
353
357
|
if (current === containersByReactRootID[reactRootID]) {
|
|
@@ -363,7 +367,7 @@ function findFirstReactDOMImpl(node) {
|
|
|
363
367
|
* here.
|
|
364
368
|
*/
|
|
365
369
|
var TopLevelWrapper = function () {};
|
|
366
|
-
TopLevelWrapper.
|
|
370
|
+
TopLevelWrapper.prototype.isReactComponent = {};
|
|
367
371
|
if (process.env.NODE_ENV !== 'production') {
|
|
368
372
|
TopLevelWrapper.displayName = 'TopLevelWrapper';
|
|
369
373
|
}
|
|
@@ -391,6 +395,9 @@ TopLevelWrapper.prototype.render = function () {
|
|
|
391
395
|
* Inside of `container`, the first element rendered is the "reactRoot".
|
|
392
396
|
*/
|
|
393
397
|
var ReactMount = {
|
|
398
|
+
|
|
399
|
+
TopLevelWrapper: TopLevelWrapper,
|
|
400
|
+
|
|
394
401
|
/** Exposed for debugging purposes **/
|
|
395
402
|
_instancesByReactRootID: instancesByReactRootID,
|
|
396
403
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
var assign = require('./Object.assign');
|
|
15
15
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
16
|
-
var joinClasses = require('
|
|
16
|
+
var joinClasses = require('fbjs/lib/joinClasses');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates a transfer strategy that will merge prop values using the supplied
|
package/lib/ReactRef.js
CHANGED
|
@@ -59,8 +59,7 @@ ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
|
|
|
59
59
|
var prevEmpty = prevElement === null || prevElement === false;
|
|
60
60
|
var nextEmpty = nextElement === null || nextElement === false;
|
|
61
61
|
|
|
62
|
-
return
|
|
63
|
-
// This has a few false positives w/r/t empty components.
|
|
62
|
+
return(
|
|
64
63
|
// This has a few false positives w/r/t empty components.
|
|
65
64
|
prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
|
|
66
65
|
);
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -44,6 +44,7 @@ function findAllInRenderedTreeInternal(inst, test) {
|
|
|
44
44
|
}
|
|
45
45
|
var publicInst = inst.getPublicInstance();
|
|
46
46
|
var ret = test(publicInst) ? [publicInst] : [];
|
|
47
|
+
var currentElement = inst._currentElement;
|
|
47
48
|
if (ReactTestUtils.isDOMComponent(publicInst)) {
|
|
48
49
|
var renderedChildren = inst._renderedChildren;
|
|
49
50
|
var key;
|
|
@@ -53,7 +54,7 @@ function findAllInRenderedTreeInternal(inst, test) {
|
|
|
53
54
|
}
|
|
54
55
|
ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
|
|
55
56
|
}
|
|
56
|
-
} else if (
|
|
57
|
+
} else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
|
|
57
58
|
ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
|
|
58
59
|
}
|
|
59
60
|
return ret;
|
|
@@ -99,7 +100,7 @@ var ReactTestUtils = {
|
|
|
99
100
|
// this returns when we have DOM nodes as refs directly
|
|
100
101
|
return false;
|
|
101
102
|
}
|
|
102
|
-
return typeof inst.render === 'function' && typeof inst.setState === 'function';
|
|
103
|
+
return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
|
|
103
104
|
},
|
|
104
105
|
|
|
105
106
|
isCompositeComponentWithType: function (inst, type) {
|
|
@@ -150,11 +151,16 @@ var ReactTestUtils = {
|
|
|
150
151
|
* components with the class name matching `className`.
|
|
151
152
|
* @return {array} an array of all the matches.
|
|
152
153
|
*/
|
|
153
|
-
scryRenderedDOMComponentsWithClass: function (root,
|
|
154
|
+
scryRenderedDOMComponentsWithClass: function (root, classNames) {
|
|
155
|
+
if (!Array.isArray(classNames)) {
|
|
156
|
+
classNames = classNames.split(/\s+/);
|
|
157
|
+
}
|
|
154
158
|
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
|
|
155
159
|
if (ReactTestUtils.isDOMComponent(inst)) {
|
|
156
|
-
var
|
|
157
|
-
return
|
|
160
|
+
var classList = ReactDOM.findDOMNode(inst).className.split(/\s+/);
|
|
161
|
+
return classNames.every(function (className) {
|
|
162
|
+
return classList.indexOf(className) !== -1;
|
|
163
|
+
});
|
|
158
164
|
}
|
|
159
165
|
return false;
|
|
160
166
|
});
|
|
@@ -387,7 +393,7 @@ function makeSimulator(eventType) {
|
|
|
387
393
|
|
|
388
394
|
ReactUpdates.batchedUpdates(function () {
|
|
389
395
|
EventPluginHub.enqueueEvents(event);
|
|
390
|
-
EventPluginHub.processEventQueue();
|
|
396
|
+
EventPluginHub.processEventQueue(true);
|
|
391
397
|
});
|
|
392
398
|
};
|
|
393
399
|
}
|
package/lib/ReactVersion.js
CHANGED
package/lib/SyntheticEvent.js
CHANGED
|
@@ -23,7 +23,6 @@ var warning = require('fbjs/lib/warning');
|
|
|
23
23
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
24
24
|
*/
|
|
25
25
|
var EventInterface = {
|
|
26
|
-
path: null,
|
|
27
26
|
type: null,
|
|
28
27
|
// currentTarget is set when dispatching; no use in copying it here
|
|
29
28
|
currentTarget: emptyFunction.thatReturnsNull,
|
|
@@ -33,7 +33,7 @@ var React = require('./React');
|
|
|
33
33
|
*
|
|
34
34
|
* var instances = renderHierarchy(
|
|
35
35
|
* function(ComponentA[, ComponentB, ComponentC]) {
|
|
36
|
-
*
|
|
36
|
+
* ReactDOM.render(<ComponentA />, ...);
|
|
37
37
|
* })
|
|
38
38
|
* );
|
|
39
39
|
* instances[0][0]; // First return value of first render method.
|
package/lib/getTestDocument.js
CHANGED
|
@@ -12,17 +12,10 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
function getTestDocument(markup) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
document.
|
|
18
|
-
|
|
19
|
-
var testDocument = iframe.contentDocument || iframe.contentWindow.document;
|
|
20
|
-
testDocument.open();
|
|
21
|
-
testDocument.write(markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>');
|
|
22
|
-
testDocument.close();
|
|
23
|
-
|
|
24
|
-
iframe.parentNode.removeChild(iframe);
|
|
25
|
-
return testDocument;
|
|
15
|
+
document.open();
|
|
16
|
+
document.write(markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>');
|
|
17
|
+
document.close();
|
|
18
|
+
return document;
|
|
26
19
|
}
|
|
27
20
|
|
|
28
21
|
module.exports = getTestDocument;
|
|
@@ -143,14 +143,19 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
143
143
|
} else if (type === 'object') {
|
|
144
144
|
var addendum = '';
|
|
145
145
|
if (process.env.NODE_ENV !== 'production') {
|
|
146
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
|
|
147
|
+
if (children._isReactElement) {
|
|
148
|
+
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
|
|
149
|
+
}
|
|
146
150
|
if (ReactCurrentOwner.current) {
|
|
147
151
|
var name = ReactCurrentOwner.current.getName();
|
|
148
152
|
if (name) {
|
|
149
|
-
addendum
|
|
153
|
+
addendum += ' Check the render method of `' + name + '`.';
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
|
-
|
|
157
|
+
var childrenString = String(children);
|
|
158
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
|