coy
element attribute manipulation.
npm install coy
usage
pass node reference to constructor. exposes four methods.
var body = ;
bodyaddbodyremovebodytogglebodyhas
all methods accept an arbitrary number of arguments.
every method but has is chainable.
arguments can be of type string, array, or object.
-
string will add or remove a class to the element.
-
array will add or remove each item as a class to the element.
-
dictionary will add or remove attributes. key as attribute name, value as attribute value.
has returns true only if all attributes match.
e.g.,
;
further examples
var element = ; element ; element ; elementelement;element;element;element;element;element;