Skip to content

Commit

Permalink
Remove spurious whitespace from class name list before splitting to e…
Browse files Browse the repository at this point in the history
…liminate null strings, which generate an error from classed(value, false). Fixes #675.
  • Loading branch information
krid committed Jun 20, 2012
1 parent ad43a2e commit 7e0daf2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/selection-classed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
d3_selectionPrototype.classed = function(name, value) {
var names = name.split(d3_selection_classedWhitespace),
var names = d3_collapse(name).split(" "),
n = names.length,
i = -1;
if (arguments.length > 1) {
Expand All @@ -11,8 +11,6 @@ d3_selectionPrototype.classed = function(name, value) {
}
};

var d3_selection_classedWhitespace = /\s+/g;

function d3_selection_classed(name, value) {
var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");

Expand Down

0 comments on commit 7e0daf2

Please sign in to comment.