
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
ampersand-dom
Advanced tools
Minimal util-layer for applying transformations to DOM.
It's a pretty thin layer on top of DOM APIs.
It has zero dependencies.
npm install ampersand-dom
When setting something to a falsy value: NaN, undefined, null, and false all become ''. However, 0 becomes "0" in order to allow setting 0 as the text content of an element.
Here are all the methods and their usage:
var dom = require('ampersand-dom');
// sets text content of element
dom.text(el, 'set text content');
// uses classList if available
dom.addClass(el, 'someclass');
dom.hasClass(el, 'someclass'); // => true
dom.removeClass(el, 'someclass');
// removes old if found, adds new
dom.switchClass(el, 'oldclass', 'newclass');
// makes sure attribute (with no content) is added
// if exists it will be cleared of content
dom.addAttribute(el, 'checked');
// returns true if that the element has an attribute with that name
dom.hasAttribute(el, 'checked'); // => true
// completely removes attribute
dom.removeAttribute(el, 'checked');
// sets attribute to string value given, clearing any current value
dom.setAttribute(el, 'value', 'the value');
// sets display none
dom.hide(el);
// hide takes a second parameter which changes
// the css property used to hide the element
// sets visibility hidden
dom.hide(el, 'visibility');
// shows element, trying to determine it's default display state
// based on tagname and getComputedStyle()
dom.show(el);
// show also takes a second parameter which changes
// the css property used to show the element
// sets visibility on element based on its previous value
dom.show(el, 'visibility');
// toggle display of element, between show/hide
dom.toggle(el);
// toggle also takes the same second parameter as show/hide
// which changes the css property used to show or hide
// the element
dom.toggle(el, 'visibility');
// sets inner HTML, takes string or DOM
dom.html(el, '<div></div>');
Initially created by @HenrikJoreteg with much inspiration/discussion with @philip_roberts.
MIT
FAQs
Super light-weight DOM manipulation lib.
The npm package ampersand-dom receives a total of 390 weekly downloads. As such, ampersand-dom popularity was classified as not popular.
We found that ampersand-dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.