A tiny DOM helper for selecting elements and manipulating CSS classes.
- Size: ~2.38KB minified (
quentin.min.js) - Demo: https://lucianbuzzo.github.io/quentin/
q() returns a wrapped array-like collection of DOM nodes with chainable methods.
<script src="quentin.js"></script>q("li.active").removeClass("active").addClass("done");npm install
npm run lint
npm run typecheck
npm testSelects elements with document.querySelectorAll(selector) and wraps them.
Adds a class to each element in the collection.
Removes a class from each element in the collection.
If any selected element has the class, remove from all. Otherwise add to all.
Returns true if at least one selected element has the class.
Find descendants from each selected element.
Returns a wrapped collection containing only the first/last element.
Returns a wrapped collection containing only the element at index.
Out-of-range indexes return an empty collection.
Reads dataset values.
data("foo")-> single value or array of valuesdata()-> single dataset object or array of dataset objects
Always returns an array of matching dataset values (or dataset objects).
Always returns the first matching dataset value/object (or undefined).
Traversal helpers based on the first selected element. When selection is empty they return an empty collection (safe no-op).
Versioning/release PRs are managed with Release Please. Conventional commit types map to changelog sections (Features, Fixes, Docs, etc.).
We use Conventional Commits: