1. component-classes
Cross-browser element class list
component-classes
Package: component-classes
Created by: component
Last modified: Mon, 13 Jun 2022 19:55:58 GMT
Version: 1.2.6
License: MIT
Downloads: 1,927,467
Repository: https://github.com/component/classes

Install

npm install component-classes
yarn add component-classes

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code