Skip to content

Commit

Permalink
Short-circuit for speed.
Browse files Browse the repository at this point in the history
Thanks, @mbostock!
  • Loading branch information
jasondavies committed Sep 29, 2011
1 parent 927426f commit adec0a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions d3.js
Expand Up @@ -1339,9 +1339,8 @@ d3_selectionPrototype.classed = function(name, value) {
while (++i < n) d3_selection_classed.call(this, names[i], value);
return this;
} else {
value = true;
while (++i < n) value = value && d3_selection_classed.call(this, names[i]);
return value;
while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false;
return true;
}
}
return d3_selection_classed.apply(this, arguments);
Expand Down

0 comments on commit adec0a6

Please sign in to comment.