Is jQuery Too Bloated? Try jquip.

Craig Buckler
Craig Buckler

It’s been a busy few weeks for jQuery developers. We’ve received jQuery 1.7 and jQuery Mobile, but a third project is now vying for our attention…

At a little over 32KB for the minified and gzipped download, few people could accuse jQuery of obesity. But it’s rare you need all its abilities. Enter jquip — or jQuery-In-Parts; a smaller, leaner and faster fork of library. It contains 90% of the best parts at a fraction of the size — just 4.28KB (even the uncompressed source is a mere 21.5KB).

You get a lot of functionality in that tiny package:

  • the main $(selector)
  • DOM traversal methods such as eq, first, last, slice, prev, next, siblings, children, etc.
  • DOM modification methods such as append, prepend and remove
  • CSS class modification methods such as hasClass, addClass and removeClass
  • Event methods such as bind and unbind with all the standard types (click, mouseenter mouseleave, submit etc.)
  • Utility functions such as each, trim, extend, merge, isArray, etc.

The library has a modular architecture so other jQuery facilities are available as plugins which can be included when you require them:

  • documentReady: $(function()) and $.ready
  • css: css, Width and Height methods
  • ajax: ajax, get and getJSON methods
  • custom: various methods such as queryString and event object isTab, isShift, and cancelEvent

The distribution package provides the plugins as separate scripts and within a single 20KB jquip file — which is just 7.84KB when gzipped. Ultimately, jquip’s developers Demis Bellot and Jey Balachandran hope to implement all the missing jQuery methods as plugins.

I’m impressed. In an age of monolithic multi-megabyte pages, it proves some developers still care about nimble lightweight code. And there are good reasons to trim the fat given the increased popularity of modestly-powered smartphones, eReaders and tablets. jquip could be a magical diet pill for your site’s slimming regime.