Yet another jQuery "replacement"
npm install squerysquery is based on the awesome bling.js and brings the following extensions:
- .off support. Even without a listener.
- .on and .off support multiple space-separated event names.
- $('a') returns a Node when only one element is matched, otherwise a NodeList.
squery currently weights 376 bytes gzipped.
npm i --save squery
`Examples
``js
// working on a single element
$('#id').classList.add('newclass');
$('#id').style.backgroundColor = 'red';
$('#id').on('click focus', handler);
$('#id').off('click focus');
$('#id').find('div').on(handler);
window.on('resize', handler);
window.off('resize');// working on multiple elements
$('a').forEach((el) => {
el.style.color = 'red';
});
$('a').on('click focus', handler);
$('a').off('click focus', handler);
```© silverwind, distributed under BSD licence