component-classes
Cross-browser element class list
Last updated 5 years ago by ockham .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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 (5 years ago)

7 Versions

  • 1.2.6                                ...           5 years ago
  • 1.2.5                                ...           5 years ago
  • 1.2.4                                ...           6 years ago
  • 1.2.3                                ...           6 years ago
  • 1.2.2                                ...           6 years ago
  • 1.2.1                                ...           7 years ago
  • 1.2.0                                ...           7 years ago
Downloads
Today 617
This Week 8,618
This Month 617
Last Day 8,001
Last Week 45,324
Last Month 182,945
Dependencies (1)
Dev Dependencies (2)
Dependents (258)

Copyright 2014 - 2016 © taobao.org |