Skip to content

Commit

Permalink
Compiled className fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shshaw committed Jan 11, 2018
1 parent bc1f49c commit 0e9d1c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions dist/cash.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@
return (v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className));
}

function addClass(v, c, spacedName) {
function addClass(v, c) {
if (v.classList) {
v.classList.add(c);
} else if (spacedName.indexOf(" " + c + " ")) {
} else if (!hasClass(v, c)) {
v.className += " " + c;
}
}
Expand All @@ -278,9 +278,8 @@
var classes = getClasses(c);

return (classes ? this.each(function (v) {
var spacedName = " " + v.className + " ";
each(classes, function (c) {
addClass(v, c, spacedName);
addClass(v, c);
});
}) : this);
},
Expand Down Expand Up @@ -370,12 +369,11 @@
}
var classes = getClasses(c);
return (classes ? this.each(function (v) {
var spacedName = " " + v.className + " ";
each(classes, function (c) {
if (hasClass(v, c)) {
removeClass(v, c);
} else {
addClass(v, c, spacedName);
addClass(v, c);
}
});
}) : this);
Expand Down
Loading

0 comments on commit 0e9d1c6

Please sign in to comment.