Skip to content

Commit

Permalink
Don't use for...of on table children.
Browse files Browse the repository at this point in the history
We can't assume `children` is an array, as it is a single
element when only one child is passed.

Fixes mui#1531, mui#1972, mui#2058 and removes need for a Symbol
polyfill.
  • Loading branch information
STRML committed Jan 12, 2016
1 parent 2b60b87 commit 7c4df70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/table/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ const Table = React.createClass({
let tFoot;
let tBody;

for (let child of children) {
if (!React.isValidElement(child)) continue;
React.Children.forEach(children, (child) => {
if (!React.isValidElement(child)) return;

let displayName = child.type.displayName;
if (displayName === 'TableBody') {
Expand All @@ -300,7 +300,7 @@ const Table = React.createClass({
else if (displayName === 'TableFooter') {
tFoot = this._createTableFooter(child);
}
}
});

// If we could not find a table-header and a table-body, do not attempt to display anything.
if (!tBody && !tHead) return null;
Expand Down

0 comments on commit 7c4df70

Please sign in to comment.