Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Super tiny chainable and extendable tool wrapping native `querySelectorAll` for selecting, creating and filtering DOM Elements with ease.
Super tiny chainable and extendable tool wrapping native querySelectorAll
for selecting, creating and filtering DOM Elements with ease.
~750b Gzipped.
const el = document.querySelector('#section');
if (el) {
el.style.color = 'green';
}
$('#section')(el => el.style.color = 'green');
const elements = document.querySelectorAll('div, p');
for (let i = 0; i < elements.length; ++i) {
elements[i].style.color = 'green';
}
if (elements.length) {
elements[elements.length - 1].style.color = 'red';
}
$('div, p')
.each(el => el.style.color = 'green')
.last(el => el.style.color = 'red');
npm install --save bonze
import $ from 'bonze';
From Unpkg.com
<script src="https://unpkg.com/bonze@latest"></script>
<script src="https://unpkg.com/bonze@latest/dist/bonze.esm.min.js"></script>
If you include bonze this way use bonze
instead of $
in the examples below.
$(() => {
document.body.classList.add('ready');
});
$('h1, h2, h3').each(headings => {
headings.classList.add('red');
});
$('h1, h2, h3')(headings => { // Shortcut for each
headings.classList.add('red');
});
$('h1, h2, h3', '#article')(headings => {
headings.classList.add('red');
});
$('div').first(div => {
div.classList.add('first');
});
$('div').nth(2, div => {
div.classList.add('third');
});
$('div').last(div => {
div.classList.add('last');
});
$('div').odd(div => {
div.classList.add('odd');
});
$('div').even(div => {
div.classList.add('even');
});
$('div').filter(div => div.textContent.includes('error'), div => {
div.classList.add('red');
});
$('<h1>My New Title</h1>')((h1) => {
document.body.prepend(h1);
});
$('div')
((div, i) => {
div.innerHTML = 'Paragraph ' + i;
})
(div => {
div.classList.add('green');
})
.last(div => {
div.classList.add('red');
});
$.plugin('addClass', (el, index, elmts, name) => {
el.classList.add(name);
});
$('div').odd().addClass('black');
$('div').even().addClass('white');
const domElementArray = $('div')();
const domFirstElement = $('div')(0);
const domSecondElement = $('div')(1);
Icon made by Freepik from www.flaticon.com.
FAQs
Super tiny chainable and extendable tool wrapping native `querySelectorAll` for selecting, creating and filtering DOM Elements with ease.
We found that bonze 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.