mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #3857 from spicyj/dev-rckv
Set _reactChildKeysValidated in dev mode only
This commit is contained in:
@@ -157,19 +157,21 @@ ReactElement.createElement = function(type, config, children) {
|
||||
} else if (childrenLength > 1) {
|
||||
var childArray = Array(childrenLength);
|
||||
|
||||
// To make comparing ReactElements easier for testing purposes, we make
|
||||
// the validation flag non-enumerable (where possible, which should
|
||||
// include every environment we run tests in), so the test framework
|
||||
// ignores it.
|
||||
try {
|
||||
Object.defineProperty(childArray, '_reactChildKeysValidated', {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
} catch (x) {
|
||||
if (__DEV__) {
|
||||
// To make comparing ReactElements easier for testing purposes, we make
|
||||
// the validation flag non-enumerable (where possible, which should
|
||||
// include every environment we run tests in), so the test framework
|
||||
// ignores it.
|
||||
try {
|
||||
Object.defineProperty(childArray, '_reactChildKeysValidated', {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
} catch (x) {
|
||||
}
|
||||
childArray._reactChildKeysValidated = true;
|
||||
}
|
||||
childArray._reactChildKeysValidated = true;
|
||||
|
||||
for (var i = 0; i < childrenLength; i++) {
|
||||
childArray[i] = arguments[i + 2];
|
||||
|
||||
Reference in New Issue
Block a user