component-classes
Cross-browser element class list
Last updated 9 years ago by ockham .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install component-classes 
SYNC missed versions from official npm registry.

classes

Cross-browser element class manipulation, utilizing the native .classList when possible. This is not designed to be a .classList polyfill.

Installation

$ component install component/classes

Example

var classes = require('classes');
classes(el)
  .add('foo')
  .toggle('bar')
  .remove(/^item-\d+/);

API

.add(class)

Add class.

.remove(class)

Remove class name or all classes matching the given regular expression.

.toggle(class)

Toggle class.

.has(class)

Check if class is present.

.array()

Return an array of classes.

Test

$ make test

License

MIT

Current Tags

  • 1.2.6                                ...           latest (9 years ago)

7 Versions

  • 1.2.6                                ...           9 years ago
  • 1.2.5                                ...           9 years ago
  • 1.2.4                                ...           10 years ago
  • 1.2.3                                ...           10 years ago
  • 1.2.2                                ...           10 years ago
  • 1.2.1                                ...           11 years ago
  • 1.2.0                                ...           11 years ago

Copyright 2013 - present © cnpmjs.org | Home |