Fix infinite recursion in browsers with iterators

My old code here didn't work properly -- for a string child, getIteratorFn would return an iterator that gave each character as its own string, and we'd attempt to loop over that too.

Tests now work in Chrome again.
This commit is contained in:
Ben Alpert 2015-04-29 00:21:00 -07:00
parent 1d8025258a
commit 8cf226e442
2 changed files with 4 additions and 2 deletions

View File

@ -194,7 +194,10 @@ function validateChildKeys(node, parentType) {
validateChildKeys(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
} else if (
typeof node === 'string' || typeof node === 'number' ||
ReactElement.isValidElement(node)
) {
// This element was passed in a valid location.
return;
} else if (node) {

View File

@ -173,7 +173,6 @@ describe('ReactElementValidator', function() {
it('does not warn for keys when passing children down', function() {
spyOn(console, 'error');
debugger;
var Wrapper = React.createClass({
render: function() {
return (