0.3.2 • Published 8 years ago
squery v0.3.2
squery
Yet another jQuery "replacement"
squery is based on the awesome bling.js and brings the following extensions:
.offsupport. Even without a listener..onand.offsupport multiple space-separated event names.$('a')returns aNodewhen only one element is matched, otherwise aNodeList.
squery currently weights 376 bytes gzipped.
Install
npm i --save squeryExamples
// 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