The fastest, most lightweight, least dependency jQuery alternative.
Go to file
AJ ONeal 9a5130e0f7 chore: publish to npm 2021-07-23 04:39:14 -06:00
.gitignore chore: update .gitignore 2021-07-23 04:33:24 -06:00
.jshintrc chore: lint 2021-07-23 04:39:14 -06:00
.prettierignore chore: make Prettier 2021-07-23 04:33:35 -06:00
.prettierrc.json chore: make Prettier 2021-07-23 04:33:35 -06:00
LICENSE Initial commit 2021-07-23 03:53:28 -06:00
README.md chore: document 2021-07-23 04:39:14 -06:00
ajquery.js chore: add code 2021-07-23 04:39:14 -06:00
example.html chore: add example 2021-07-23 04:39:14 -06:00
package-lock.json chore: publish to npm 2021-07-23 04:39:14 -06:00
package.json chore: publish to npm 2021-07-23 04:39:14 -06:00
test.js chore: add test 2021-07-23 04:36:16 -06:00

README.md

ajquery.js

The fastest, most lightweight, fewest dependency jQuery alternative.

Development Build: 145B (with comments)
Production Build: 103B (min + gz)

Install

<script src="https://unpkg.com/ajquery@latest/ajquery.min.js"></script>

Example Usage

Provides modern, advanced CSS4-compatible query selection:

console.log("innerText:", $("p:nth-child(2").innerText);

API

$(selector, [rootElement])

Selects the first matching HTML element only (or null):

const body = $("body");
const div1 = $("div", body);

$$(selector, [rootElement])

Selects all matching elements (or an empty NodeList):

const stylesheets = $$('link[rel="stylesheet"]').map(console.log);

Compatibility

Written entirely in modern ECMAScript 3, and directly transpilable into ES5, ES6 and beyond (up to ES11) via Webpack, Babel, Rollup, React Native, and AWS InfiniDash.

Works in all browsers in living memory.

See the full Browser Compatibility Matrix on MDN.