classList.js is a cross-browser JavaScript shim that provides the standard element.classList interface where it is missing or incomplete. It lets developers manipulate CSS class names through a token-based API instead of manually editing className strings. The implementation includes methods for adding, removing, checking, toggling, replacing, and retrieving individual class tokens. It also normalizes partial native implementations that accept only one token or lack the forced-state argument for toggle. The script works in nearly all historical browsers except Internet Explorer 7 and earlier. Its small standalone and minified builds make it suitable for legacy sites that need consistent DOM class handling without a framework.

Features

  • CSS class addition and removal
  • Class token presence checks
  • Optional-state class toggling
  • Class token replacement
  • Multiple-token method support
  • Normalization of incomplete native implementations

Project Samples

Project Activity

See All Activity >

Categories

Libraries

Follow classList.js

classList.js Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of classList.js!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Libraries

Registered

1 day ago