Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created January 14, 2012 22:44
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Raynos/1613169 to your computer and use it in GitHub Desktop.
Save Raynos/1613169 to your computer and use it in GitHub Desktop.
Why you don't need jQuery

Why the jQuery Abstraction isn't needed.

(One needs some form of browser normalization so that modern features works, no-one is doubting that).

Related: jQuery library critique

Abstractions that aren't needed

Selectors

QSA works (shim=sizzle). Besides selectors are generally bad practice. Favour node traversal, gEBI, gEBTN and gEBCN. (shim=domShim)

Attributes

The DOM attribute API works. Besides one rarely touches attributes and one rarely touches innerHTML. Generally one manipulates properties

Data

properties work, weakmaps work (shim=weakmap-shim)

Deferred Object

Promises, deferreds, futures, etc aren't that useful. Favour managing callbacks and using flow control techniques.

Events

DOM2 events work (shim=domshim). You don't need anything else.

Forms

The HTML form element is more useful. Doesn't give any useful abstraction

Manipulation, Traversing

The DOM works (shim=domShim). If you want set like behaviour you can use NodeComposite

Utilities

ES5 works (shim=ES5shim)

Ajax

For simple use cases the XHR API is trivial to use. For more complex use cases you can use a library like xhr

It should be noted that there is no solid shim for XHR2 yet, including file uploads & CORS.

Todo: Write an XHR2 shim

Abstractions that are still needed

CSS, Dimensions, Offset

I havn't seen any good CSS normalization shims. One propably needs some form of abstraction to handle CSS nicely.

Todo: Write an CSSOMView shim and a CSSOM shim.

Effects

Animations, Don't know of a good CSS3 shim, so we still need a browser abstraction.

Todo: Find an elegant standards compliant polyfill / shim solution to programmatic animations.

@Raynos
Copy link
Author

Raynos commented Mar 5, 2012

.... jq.mobi is also a troll

if IE -> dom shim
else -> nothing

@devinrhode2
Copy link

So true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment