1.0.1 • Published 7 years ago

classlist-multiple-values v1.0.1

Weekly downloads
375
License
MIT
Repository
github
Last release
7 years ago

classlist-multiple-values

Build Status BrowserStack Status

Use multiple values for classList.add and classList.remove methods.

Install

npm install classlist-multiple-values --save

Usage

const multipleValues = require('classlist-multiple-values');
const element = document.querySelector('.jackie');

const cl = multipleValues(element.classList);

cl.add('henry winnie');
cl.add(['scooter', 'emma']);

cl.remove('henry winnie');
cl.remove(['scooter', 'emma']);

API

multipleValues(classList)

Returns: Object

Returns improved add and remove methods.

classList

Type: Object|DOMTokenList

Object or DOMTokenList which must contain add and remove methods.

multipleValues.add(values)

values

Type: String[]|String

Array of strings or space-separated string of class values to add to the element.

multipleValues.remove(values)

values

Type: String[]|String

Array of strings or space-separated string of class values to remove from the element.

Test

For local automated tests, run npm run test:automated:local.

Browser support

Tested in IE9+ and all modern browsers.

License

MIT © Ivan Nikolić