Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add toggle to clazz api
  • Loading branch information
bryanjswift committed Mar 8, 2013
1 parent becd8cb commit 5641470
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/modules/clazz.js
Expand Up @@ -26,10 +26,20 @@ define(function() {
}
}

function toggleClass(node, className) {
if (hasClass(node, className)) {
removeClass(node, className);
} else {
addClass(node, className);
}
}


var api = {
add: addClass,
has: hasClass,
remove: removeClass
remove: removeClass,
toggle: toggleClass
};

return api;
Expand Down

0 comments on commit 5641470

Please sign in to comment.