component-classes

1.2.6 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.6
    446,355
    • latest

Version History

Package Sidebar

Install

npm i component-classes

Weekly Downloads

446,429

Version

1.2.6

License

MIT

Last publish

Collaborators

  • ockham
  • defunctzombie
  • dfcreative
  • mattmueller
  • tjholowaychuk
  • rauchg
  • retrofox
  • coreh
  • forbeslindesay
  • kelonye
  • yields
  • anthonyshort
  • ianstormtaylor
  • cristiandouce
  • swatinem
  • stagas
  • amasad
  • juliangruber
  • calvinfo
  • dominicbarnes
  • jongleberry
  • timoxley
  • jonathanong
  • queckezz
  • nami-doc
  • clintwood
  • thehydroimpulse
  • stephenmathieson
  • trevorgerhardt
  • timaschew
  • tootallnate
  • hughsk