

JQuery 1.8 Released - warp
http://blog.jquery.com/2012/08/09/jquery-1-8-released/

======
kvnn
Hey dmethvin,

You guys are doing awesome work. Thank you.

------
Axsuul
_jQuery’s selector engine is faster than ever, thanks to a rewrite (well,
really two rewrites) by Timmy Willison._

Would love to see some benchmarks!

~~~
mattparlane
<http://jsperf.com/sizzle-1-7-2-vs-1-8>

~~~
mpd
According to a few runs of this benchmark, a number of these tests are slower
in 1.8, particularly selecting by class. That's rather off-putting. I hope
it's just me.

Using Chrome 21.0.1180.57 on OSX.

~~~
mattparlane
I ran it a few times as well and most of the benchmarks seemed to be within
statistically insignificant margins, except for three which were much faster
-- including $('#id'), which has got to be the most common selector (at least
it is in my code).

I think it's still worth the upgrade.

~~~
mpd
I use class selection most often, so any slowdown there is a cause of concern
for me. The other slowdowns are not as big of a deal, providing it means
speedups in more important places.

~~~
dmethvin
On my system these are the results for the class selector test:

    
    
       1.7.2  4,123 ops/s   242 microseconds/op  
       1.8.0  4,061 ops/s   246 microseconds/op  
    

Are you seeing some large difference? You'd need to be selecting things by
class several hundreds of times a second before it could possibly make a
difference.

In practical terms, the speedup in custom selectors is probably the most
important, since they are so slow.

~~~
mpd
It's a small difference, but these small differences version after version add
up to a lot of nickels.

As I mentioned in another comment, increasing performance for ID selection
(which is already much, much faster than other types) at the expense of other
types makes for sexy benchmarks, but is less than stellar in the real world.

~~~
bzbarsky
Just out of curiousity, have you considered using querySelector or
querySelectorAll directly for your really hot cases? There's a good chance
that it'll be faster than the jQuery version in the non-ID cases.

~~~
mpd
Yeah, that's one of the first steps if a selection benchmarks slowly. I just
dislike adding complexity in any form. It adds up so quickly in complex
software.

------
solox3
jQuery is now modular, but jQuery.com doesn't have the custom download option
like they do for jQuery UI's themeroller. When that comes out, it's going to
be big news yet again.

~~~
dmethvin
It's much easier to make jQuery UI modular than it is to make jQuery core
modular. You know that you're using autocomplete, tabs, sliders, or dialogs;
you can see them on the screen. If you're including jQuery core with several
jQuery plugins it won't always be clear which parts of jQuery core you are
using, either directly or through those plugins. If you already know your
project's dependencies, the grunt build option in 1.8 gives you that
flexibility now so there's no need to wait. If you don't know those
dependencies, a page of check boxes will just make creating and debugging a
working build more frustrating. Closure Compiler Advanced Optimizations
promise to automate that process, but we still have a way to go on getting
that integrated into jQuery.

------
andrewfelix
_> Automatic CSS prefixing_

Does this mean I can apply rounded corners via jquery css without having to
write 4 separate css properties for each browser?

~~~
dfischer
I wouldn't recommend using jQuery to style your site. That sounds incredibly
silly. Apply a class that is already properly prefixed. You can use a tool
like www.compass-style.org to write one line that writes it for all. Please
don't use jQuery for styling.

------
kemayo
_We don’t expect to get any bug reports on this release, since there have been
several betas and a release candidate that everyone has had plenty of
opportunities to thoroughly test. Ha ha, that joke never gets old. We know
that far too many of you wait for a final release before even trying it with
your code. So now there is really no reason to wait, and you can find out if
there are any bugs you could have reported earlier._

Is it just me, or is that overly passive-aggressive for a release
announcement?

~~~
dmethvin
I hoped it was funny. I also hoped it would take some of the fury off the bug
reports from people who hadn't tried any of the betas or RCs and now are
finding problems. Like this one that just arrived:
<http://bugs.jquery.com/ticket/12232>

~~~
IanDrake
Honestly, I don't know how you deal with some people's complaints.

------
shortlived

      Size reduction wasn’t our primary goal in this version,  
      but we felt it was important to hold the line on code  
      growth, and we definitely achieved that.   
    

Does anyone have pointers to examples of specific changes between 1.7.2 and
1.8 in this area?

~~~
dmethvin
A very large number of them were code refactors to take better advantage of
gzip; Richard Gibson (gibson042) has become a master of that [1]. It turns out
that a good style guide can actually help improve gzip compression as well
[2]. Others were things like an optimization for $("body") which we pulled out
[3]. Its main job seems to have been to look good on a circa-2008 benchmark
that didn't cache its selectors. The Sizzle optimizations that Timmy Willison
(timmywil) did pretty much made the jQuery-side optimizations unnecessary
anyway.

[1] <https://github.com/jquery/jquery/pull/788> [2]
<https://github.com/jquery/jquery/pull/840> [3]
[https://github.com/jquery/jquery/commit/9ebc27db54194c88fa7a...](https://github.com/jquery/jquery/commit/9ebc27db54194c88fa7aed29a8c648c330300ac8)

------
MartinMond
Finally we can use border-box box-sizing everywhere!
<http://paulirish.com/2012/box-sizing-border-box-ftw/> The bug has been fixed:
<http://bugs.jquery.com/ticket/11004>

~~~
WickyNilliams
Good eyes! I completely missed that in the changelog. border-box: box-sizing
really makes life easier when working with complex layouts. I'm always amused
by the fact that old IE's much-berated interpretation of the box model is
actually favourable!

~~~
ethermal
indeed. I can't stand when setting width:100% can actually extend past the
bounds of the parent.

~~~
WickyNilliams
When you strip away years of familiarity and conditioning to accept the
standard box model, it's hard not to conclude that it's completely unintuitive
and back-asswards!

------
d0m
I'm less and less excited when I see new releases of jquery. I guess it's so
widely used that you can't add cool stuff without messing with already
existing code or pissing some people off.

TL & DR for the patch: \- some internal rewrite \- some small fixes \- smaller
code size

~~~
HaloZero
I think that's usually the sign of a mature platform. Less super exciting
features and better stability and reduction in code-size. It's better than the
alternative or greater and greater bloat.

~~~
ChiperSoft
Thats what I keep saying about Prototype.js

