Skip to content

npm-dom/dom-classes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Cross-browser element class manipulation

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%