Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
chi-classes
Advanced tools
Easily manage CSS classes on DOM nodes.
This module uses Node.js-style modules, for best results use browserify.
var classes = require('chi-classes');
var div = document.createElement('div');
// Add some classes
classes(div).add('foo bar');
// Remove some classes
classes(div).remove('foo bar');
// Toggle classes
classes(div).toggle('selected');
// Chaining
classes(div).add('active').remove('foo');
// Check if a node has a class
classes(div).has('foo'); // true if div has the foo class
// Check if a node has multiple classes
classes(div).has('foo bar'); // true if div has both the foo and bar classes
// Work with multiple DOM nodes
classes(a, b, c).add('foo');
classes([a, [b, c]]).add('bar');
classes(document.querySelectorAll('div')).add('i-am-a-div');
classes(a, b, c).has('foo'); // true if a, b, and c all have the foo class
classes(...nodes)
Creates a new wrapper object. nodes
can be any number of DOM nodes or arrays
containing DOM nodes. It supports infinitely nested arrays and psuedo-array
values such as NodeList
objects.
#add(classes)
Adds the specified classes to all nodes. classes
is a space-separated string
of the classes to add to the nodes.
Returns this
, which can be used to chain methods.
#remove(classes)
Removes the specified classes from all nodes. classes
is a space-separated
string of the classes to remove from the nodes.
Returns this
, which can be used to chain methods.
#toggle(classes)
Toggles the specified classes on all nodes. If a node does not contain a class, the class is added to the node. If the node already contains a class, the class is removed from the node.
Returns this
, which can be used to chain methods.
#has(classes)
Returns true
if all the nodes include all the classes specified, otherwise it
returns false
.
FAQs
Easily manage CSS classes on DOM nodes
The npm package chi-classes receives a total of 1 weekly downloads. As such, chi-classes popularity was classified as not popular.
We found that chi-classes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.