public
Last active

Why you don't need jQuery

  • Download Gist
jQuery.md
Markdown

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.

I couldn't agree more. Also for ajax, checkout request: SuperAgent by TJ Holowaychuk

If you want help with any of this, I am readily at your disposal.

You keep forgetting that people have already invested time in learning jQuery, and they've already written huge apps that don't need a rewrite using jQuery.

You're fighting two things here, not just one.

Also, IE7 or lower. You don't get to make the rules we have to play by.

That's one of the big problems, people invest time in learning jQuery when they should be investing time into host objects.

I also don't recommend you rewrite apps to remove jQuery dependency, that's a waste of time.

As for IE6/7, ugh, I fight personal battles with those because they are a pain to shim. It's easier to just ignore them.

Easier for you to ignore, not me, when I get paid to not ignore them ;-)

if IE -> jQuery
else -> jQ.Mobi

FFFFFFFFFFFFFFFFFFFFF------

jquery mobile is the biggest turd, ever.

Agreed, something like 62K!!
jQ.Mobi is not jquery mobile, quite the opposite of tastes, jQ.Mobi is a 'html5 mobile' re-write of jQuery that supports plugins, has a super lightweight selector support (which, for novice dev's isn't bad since they probably already understand css)

Basically it supports jQuery plugins, cuts out all the crap that causes memory leaks on mobile.

Oh, biggest point is that it's 5k, and twice as fast as jquery

.... jq.mobi is also a troll

if IE -> dom shim
else -> nothing

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.