Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
element attribute manipulation.
npm install coy
###usage
pass node reference to constructor. exposes four methods.
var body = coy(document.body);
body.add
body.remove
body.toggle
body.has
all methods accept an arbitrary number of arguments.
every method but has is chainable.
arguments can be of type string, array, or object.
string will add or remove a class to the element.
array will add or remove each item as a class to the element.
dictionary will add or remove attributes. key as attribute name, value as attribute value.
has returns true only if all attributes match.
e.g.,
coy(document.body).add('class', ['class1', 'class2'], {'id':'element'});
###further examples
var element = coy(document.querySelector(query))
.add('class')
.add('class', ['class1', 'class2'])
.add('class', {'id':'element'})
.add(['class1', 'class2'])
.add(['class1', 'class2'], {'id':'element'})
.add({'id':'element'}, ['class1', 'class2'])
.add({'id':'element'});
element.remove('class')
.remove('class', ['class1', 'class2'])
.remove('class', {'id':'element'})
.remove(['class1', 'class2'])
.remove(['class1', 'class2'], {'id':'element'})
.remove({'id':'element'}, ['class1', 'class2'])
.remove({'id':'element'});
element.toggle('class')
.toggle('class', ['class1', 'class2'])
.toggle('class', {'id':'element'})
.toggle(['class1', 'class2'])
.toggle(['class1', 'class2'], {'id':'element'})
.toggle({'id':'element'}, ['class1', 'class2'])
.toggle({'id':'element'});
element.has('class')
element.has('class', ['class1', 'class2']);
element.has('class', {'id':'element'});
element.has(['class1', 'class2']);
element.has(['class1', 'class2'], {'id':'element'});
element.has({'id':'element'}, ['class1', 'class2']);
element.has({'id':'element'});
FAQs
element manipulation
The npm package coy receives a total of 10 weekly downloads. As such, coy popularity was classified as not popular.
We found that coy 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.