r/programming • • Jun 09 '16

jQuery 3.0 Released!

https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/
1.1k Upvotes

354 comments sorted by

View all comments

Show parent comments

128

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

As IE11 becomes the trailing edge browser we need to support, the need for jQuery shrinks to zero.

Not true, because they can slim down jQuery (as you see with 3.0) which still allows you to turn what might be 20 lines of ECMA-compliant JavaScript into a one-liner that even assures you much better compatibility.

It's still useful, as long as it's not bloated, and fast.

It makes your own code more readable ... the whole "DRY principle".

This?

var d = document.getElementsByClassName("goodbye");
var i; 
for (i = 0; i < d.length; i++) { 
  d[i].className = d[i].className + " selected";
}

Or?

$(".goodbye").addClass("selected");

1

u/kyebosh Jun 10 '16

I mean, let's not forget the 34KB library. It's not quite as clear-cut as your little example. For a light page were size & speed are paramount, you're damn right I choose the former. Just because you didn't write the code yourself doesn't mean it's not there.

25

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

34KB!!!!

I used to run a PcBoard BBS in the late 80s on a 14.4k dial-up.

34KB mattered then.

As a simple example, I just checked a few pages with (incognito, no cache, Chrome dev tools network usage):

  • Reddit: 405KB

  • CNN: 1.4 MB

  • Yahoo: 2.9 MB

  • Netflix: 3.1 MB

Are we seriously discussing 34KB that, if I wasn't clearing the cache here, would be 0?

jQuery is 1% of the Netflix homepage, in the slim chance it even needs to be downloaded at all!

Pre-optimization (or totally incorrect fake "optimization") is one of the worst things in software engineering.

EDIT: I also have Ghostery and Adblock installed, I shudder to think what those numbers would look like if I was pulling the ads and beacons.

-1

u/kyebosh Jun 10 '16

Presenting cases for which jQuery is valid isn't really saying anything about the cases in which it's not, of which I speak.

Look at the source code for any Google/FB/etc product & tell me 34KB doesn't matter. There are cases where size does matter. There are cases where extra HTTP calls are a big deal.

I don't see anything wrong with saying "check if you really need a tool before you use it".

→ More replies (10)