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.
bianco.attr
Advanced tools
import { set, get, has, remove } from 'bianco.attr'
// set an attribute on a node
const img = document.createElement('img')
set(img, 'width', 100)
get(img, 'width') // => '100'
has(img, 'width') // => true
remove(img, 'width')
get(img, 'width') // => null
Set any attribute on a single or a list of DOM nodes
els
(HTMLElement | NodeList | Array) DOM node/s to parsename
(string | Object) either the name of the attribute to set
or a list of properties as object key - valuevalue
string the new value of the attribute (optional)import { set } from 'bianco.attr'
const img = document.createElement('img')
set(img, 'width', 100)
// or also
set(img, {
width: 300,
height: 300
})
Returns (HTMLElement | NodeList | Array) the original array of elements passed to this function
Get any attribute from a single or a list of DOM nodes
els
(HTMLElement | NodeList | Array) DOM node/s to parsename
(string | Array) name or list of attributes to getimport { get } from 'bianco.attr'
const img = document.createElement('img')
get(img, 'width') // => '200'
// or also
get(img, ['width', 'height']) // => ['200', '300']
// or also
get([img1, img2], ['width', 'height']) // => [['200', '300'], ['500', '200']]
Returns (Array | string) list of the attributes found
Remove any attribute from a single or a list of DOM nodes
els
(HTMLElement | NodeList | Array) DOM node/s to parsename
(string | Array) name or list of attributes to removeimport { remove } from 'bianco.attr'
remove(img, 'width') // remove the width attribute
// or also
remove(img, ['width', 'height']) // remove the width and the height attribute
// or also
remove([img1, img2], ['width', 'height']) // remove the width and the height attribute from both images
Returns (HTMLElement | NodeList | Array) the original array of elements passed to this function
Set any attribute on a single or a list of DOM nodes
els
(HTMLElement | NodeList | Array) DOM node/s to parsename
(string | Array) name or list of attributes to detectimport { has } from 'bianco.attr'
has(img, 'width') // false
// or also
has(img, ['width', 'height']) // => [false, false]
// or also
has([img1, img2], ['width', 'height']) // => [[false, false], [false, false]]
Returns (boolean | Array) true or false or an array of boolean values
FAQs
Helper to set/get/remove DOM attributes on a list of nodes
The npm package bianco.attr receives a total of 397 weekly downloads. As such, bianco.attr popularity was classified as not popular.
We found that bianco.attr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
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.