dom-classes
Add, change, remove DOM classes
Last updated 4 years ago by tehshrike .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dom-classes 
SYNC missed versions from official npm registry.

dom-classes

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

Install

$ npm install dom-classes

Usage

classes = require('dom-classes')

classes(el)
// => ['foo', 'bar']

API

classes(el)

Return an array of classes

classes(el)
// => ['foo', 'bar']

.add(el, class)

Add class

.remove(el, class)

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

.toggle(el, class)

Toggle class.

.has(el, class)

Check if class is present.

.contains(el, class)

Check if class is present.

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

5 Versions

  • 1.0.0                                ...           4 years ago
  • 0.0.1                                ...           6 years ago
  • 0.0.0                                ...           7 years ago
  • 0.0.1-security                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 9
Dependencies (1)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |