@samitouri / QOS-React-2 / commits / 8cf226e442

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.

Ben Alpert committed Apr 29, 2015 at 00:21 UTC 8cf226e44241aeafe147f6256a1351b46ac3cf91
2 files changed +4 -2
src/classic/element/ReactElementValidator.js
+4 -1
@@ -194,7 +194,10 @@ function validateChildKeys(node, parentType) {
194 validateChildKeys(child, parentType);
195 }
196 }
197 - } else if (ReactElement.isValidElement(node)) {
197 + } else if (
198 + typeof node === 'string' || typeof node === 'number' ||
199 + ReactElement.isValidElement(node)
200 + ) {
201 // This element was passed in a valid location.
202 return;
203 } else if (node) {
src/classic/element/__tests__/ReactElementValidator-test.js
-1
@@ -173,7 +173,6 @@ describe('ReactElementValidator', function() {
173 it('does not warn for keys when passing children down', function() {
174 spyOn(console, 'error');
175
176 - debugger;
176 var Wrapper = React.createClass({
177 render: function() {
178 return (