https://github.com/silverwind/squery
Yet another jQuery alternative
https://github.com/silverwind/squery
Last synced: 4 months ago
JSON representation
Yet another jQuery alternative
- Host: GitHub
- URL: https://github.com/silverwind/squery
- Owner: silverwind
- License: bsd-2-clause
- Created: 2016-05-16T20:27:09.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-06-03T15:43:51.000Z (about 8 years ago)
- Last Synced: 2025-10-21T01:19:51.762Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 68.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# squery
[](https://www.npmjs.org/package/squery) [](https://www.npmjs.org/package/squery) [](https://travis-ci.org/silverwind/squery)
> Yet another jQuery "replacement"
`squery` is based on the awesome [bling.js](https://gist.github.com/paulirish/12fb951a8b893a454b32) 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
````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](https://github.com/silverwind), distributed under BSD licence