squery

0.3.2 • Public • Published

squery

Yet another jQuery "replacement"

squery 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.

Install

npm i --save squery

Examples

// 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

Package Sidebar

Install

npm i squery

Weekly Downloads

0

Version

0.3.2

License

BSD-2-Clause

Last publish

Collaborators

  • silverwind