DOMTokenList static methods wrapper for element.classList
CSS JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
ClassTokenList.js Adapter for HTMLElement.classList

See also:

var foo = document.getElementById('foo');

ClassTokenList.add(foo, "crap");      // void.
ClassTokenList.add(foo, "blah");      // void.
ClassTokenList.contains(foo, "blah"); // boolean.
ClassTokenList.remove(foo, "blah");   // void.
ClassTokenList.toggle(foo, "crap");   // void.

Unlike the standard classList, toggle does not take boolean parameter force.

// container is optional.
ClassTokenList.findAncestorWithClass(foo, "bargle", document.body); 
ClassTokenList.getElementsByClassName(foo, "bargle"); // Array.