Skip to content

jkroso/classes

Repository files navigation

classes

x-browser class manipulation

Installation

With packin or component

$ packin add jkroso/classes

then in your app:

var classes = require('classes')

API

add(name, el)

Add class name if not already present.

remove(name, el)

Remove name if present. If name is a RegExp it will act like removeMatching().

removeMatching(re, el)

Remove all classes matching re.

toggle(name, el)

Toggle class name.

array(el)

Return an array of classes.

Running the tests

Just run make and navigate your browser to the test directory.

Thanks

This is very heavily based off component/classes test suite and all. This is just a port to a function based API rather than a Method based one.