component-classes
Cross-browser element class list
Last updated 4 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 (4 years ago)

7 Versions

  • 1.2.6                                ...           4 years ago
  • 1.2.5                                ...           4 years ago
  • 1.2.4                                ...           5 years ago
  • 1.2.3                                ...           6 years ago
  • 1.2.2                                ...           6 years ago
  • 1.2.1                                ...           6 years ago
  • 1.2.0                                ...           6 years ago
Downloads
Today 99
This Week 31,541
This Month 53,661
Last Day 5,987
Last Week 35,452
Last Month 146,554
Dependencies (1)
Dev Dependencies (2)
Dependents (228)

Copyright 2014 - 2017 © taobao.org |