Classist
Manage classes on an element without reguard for external modification.
why.
Sometimes you want to modify the classes on an element but in a somewhat encapsulated style.
Say you have a component that has a standard class like "modal"
, and you want to be able to
define its list of classes that changes over time, without effecting the "modal"
class..
Usage
var classis = ; // Make or aquire an elementvar element = ; // Classist it.var elementClasses = ; // Get classist classes (there are none so far); // -> '' // set classist classes; // get element.classNameelementclassName; // -> 'some thing foo bar' // Get classist classes again.; // -> 'foo bar'
See tests for more examples.