# Cash: a 6 KB jQuery alternative for modern browsers

> Cash trades jQuery's full API surface for a small chainable subset that covers everyday DOM work. It is aimed at projects that want familiar syntax without shipping a 24.4 KB gzipped library.

**fabiospampinato/cash** — An absurdly small jQuery alternative for modern browsers.

- Repository: https://github.com/fabiospampinato/cash
- Stars: 7,033 · Forks: 270
- Language: JavaScript
- License: MIT
- Published: 2026-09-22 · Updated: 2026-09-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/fabiospampinato-cash

## What Cash replaces and who it is for

Cash is a DOM manipulation library that keeps jQuery's chainable style while dropping most of jQuery's weight. The README states that 100% feature parity with jQuery is not a goal, but that Cash comes helpfully close and covers most day to day use cases. That sentence is the whole pitch, and it is also the boundary you should hold onto when evaluating it.

The audience is narrow but real: teams with existing jQuery-style code who want a smaller dependency, and new projects that only need selectors, class and attribute changes, events, forms and simple effects. The comparison table in the README puts Cash at 36.5 KB unminified, 16 KB minified and 6 KB minified and gzipped, against jQuery Slim 3.4.1 at 227 KB, 71 KB and 24.4 KB. That is a 76.6% reduction in the gzipped case, according to the project's own numbers.

What Cash is not: an animation framework, a plugin ecosystem, or a compatibility layer for old browsers. The README lists IE11+ as the floor in the description, yet the feature table marks older-browser support as absent while jQuery Slim carries it. Read those two statements together before you plan a support matrix.

## The mechanism: one selector function and a collection prototype

The entry point is a single function, `$()`. It returns what the README calls an actionable collection of nodes. The argument decides the behaviour: a selector string with an optional element or collection as context, a node, a nodeList, an HTML string, another collection (which returns itself), or a function that runs once the DOM is ready.

Methods live on the collection prototype, exposed as `$.fn`, and are called on the result of `$()`. The README groups them into attributes, collection, CSS, data, dimensions, effects, events, forms, manipulation, offset and traversal. Anything not in those groups is either absent or shipped as an extra method that is disabled by default. That default matters: a method you remember from jQuery may exist in the source tree under `src/extra` and still not be present in your build.

Internally the README says Cash uses modern browser features to minimize the codebase. It does not publish a rendering or diffing model, because there is none; this is direct DOM access with a thin wrapper. The TypeScript types are generated from the code rather than maintained separately, which the feature table contrasts with Zepto and jQuery Slim, both of which rely on DefinitelyTyped.

## Installing Cash and making a first change

There are two documented installation paths. The first is a script tag pointing at jsDelivr, which is the quickest way to try it without a build step. The README shows the minified file at `dist/cash.min.js`.

```html
<script src="https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js"></script>
<script>
  $(function () {
    $('html').addClass ( 'dom-loaded' );
    $('<footer>Appended with Cash</footer>').appendTo ( document.body );
  });
</script>
```

After the page loads you should see the `dom-loaded` class on the `html` element and a footer appended to the body. The callback form of `$()` is the document-ready hook, so the code inside it runs after the DOM is available.

The second path is npm, under the package name `cash-dom`. Note that the repository is `fabiospampinato/cash` but the published package and the import specifier are different strings.

```bash
npm install --save cash-dom
```

```js
import $ from "cash-dom";

$(function () {
  $('html').addClass ( 'dom-loaded' );
  $('<footer>Appended with Cash</footer>').appendTo ( document.body );
});
```

For a smaller bundle, the README points to a partial builds document under `docs/partial_builds.md`, which describes excluding individual methods. That is a finer grain than Zepto or jQuery Slim, which the feature table says can only exclude whole modules. If you go that route, verify the excluded method is not called anywhere in your code, because the failure appears at runtime rather than at build time.

## Where Cash stops being the right tool

The clearest limitation is stated by the project itself: feature parity with jQuery is not a goal. A codebase that leans on jQuery plugins, deferreds, or the less common traversal and manipulation helpers will find gaps. The README directs anyone migrating to a migration guide in `docs/migration_guide.md`, which is the document to read before, not after, swapping the script tag.

Browser support is the second boundary. The description says modern browsers with IE11+ in parentheses, but the comparison table marks older-browser support as absent for Cash and present for jQuery Slim. If IE11 is a hard requirement, treat that table as the deciding evidence and test before committing.

Third, some methods are opt-in. The README notes that extra methods under `src/extra` are available but disabled by default. A developer who assumes a jQuery method exists because it exists in the repository will get an undefined function at runtime. There is no documented tree-shaking warning for this; the README simply says the extras are disabled by default.

Finally, effects are limited to hide, show and toggle. If your interface depends on jQuery's animation queue, Cash is the wrong dependency, not an incomplete one.

## Cash against Zepto and jQuery Slim

The README's own comparison is the fairest starting point. Against Zepto 1.2.0, the practical difference is maintenance and typing: the table marks Zepto as not actively maintained, without namespaced events, and typed only through DefinitelyTyped, while Cash is typed in TypeScript with generated declarations and supports namespaced events. Against jQuery Slim 3.4.1, the difference is the reverse on compatibility: Slim supports older browsers and Cash does not.

Size separates them further. At 6 KB gzipped, Cash is roughly 40% of Zepto's 9.8 KB and about a quarter of jQuery Slim's 24.4 KB, using the numbers in the table. That gap is the reason to pick Cash over Slim when your browser floor is modern.

The honest framing is that Zepto and jQuery Slim are both broader in scope than Cash, and Cash is deliberately narrower. If you need the broader API, the smaller file is not a benefit; it is a missing feature. The partial build system softens this by letting you remove methods you do not use, but it does not add methods jQuery has and Cash never implemented.

## Maintenance, licence and upgrade cost

The repository is not archived, and the last push was on 2026-07-17. The most recent release listed is 8.1.5 from 2023-04-13, with 8.1.4 and 8.1.3 before it. So commits continue while tagged releases have not moved in some time. Anyone pinning to a version should plan around that gap rather than assume a release cadence.

Upgrade cost is low by construction. The package has no runtime dependencies listed in `package.json`, and the published `files` array contains only `dist`, meaning consumers receive built artifacts rather than source. The `browser`, `main`, `module` and `jsnext:main` fields all point at `dist/cash.js` or `dist/cash.esm.js`, with `types` at `dist/cash.d.ts`. A bundler that respects those fields needs no configuration.

The licence is MIT, which permits commercial and closed-source use and requires keeping the copyright notice. That is a factual description of the licence text, not legal advice; check the `license` file in the repository root if your organisation has specific requirements.

The test setup is worth knowing about because it shapes how much you can trust the API surface. The `test` script opens an HTML page, and the jQuery comparison scripts build a patched jQuery bundle from `test/jquery_patch.js` and `test/jquery_reverse_patch.js`. That is an unusual arrangement: it means the project validates itself partly by running jQuery's own test suite against Cash, which is stronger evidence than a hand-written test list, but it also means the harness depends on cloning an external repository.

## Conclusion

Adopt Cash when you want jQuery-style chaining in a modern-browser bundle and can accept that 100% feature parity is not a goal. Do not adopt it if you support IE11 with polyfills you do not control, or if your code depends on jQuery methods outside the documented collection list. Before migrating, check the migration guide in docs/ against the methods your code calls, and confirm that your build resolves the browser, main and module fields in package.json to dist/cash.js or dist/cash.esm.js.

## FAQ

### What are some good alternatives to jQuery?

Cash itself is one, and its README compares it directly with Zepto 1.2.0 and jQuery Slim 3.4.1 on size, maintenance and typing. Cash is the smallest of the three at 6 KB minified and gzipped, but it does not support older browsers the way jQuery Slim does.

### How do I install Cash-dom?

The README documents two paths: a script tag pointing at the jsDelivr build of dist/cash.min.js, or the npm package cash-dom installed with npm install --save cash-dom and imported with import $ from "cash-dom". The repository name and the package name differ.

### Is Cash a drop-in replacement for jQuery?

No. The README states that 100% feature parity with jQuery is not a goal, although it says Cash comes helpfully close and covers most day to day use cases. It points readers migrating from jQuery to a dedicated migration guide in docs/migration_guide.md.

### Which browsers does Cash support?

The description names modern browsers with IE11+ in parentheses, while the feature comparison table marks older-browser support as absent for Cash and present for jQuery Slim 3.4.1. The README does not resolve that tension, so test your target browsers directly.

### Can I build a smaller version of Cash?

Yes. The README links to a partial builds document at docs/partial_builds.md and says Cash can exclude individual methods, which it contrasts with Zepto and jQuery Slim, where only whole modules can be excluded.

## Sources

- [fabiospampinato/cash on GitHub](https://github.com/fabiospampinato/cash)
- [Issues](https://github.com/fabiospampinato/cash/issues)
- [License: MIT](https://github.com/fabiospampinato/cash/blob/master/LICENSE)
- [README](https://github.com/fabiospampinato/cash/blob/master/README.md)
- [Releases](https://github.com/fabiospampinato/cash/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/fabiospampinato-cash
