Friday, August 24th, 2007

jQuery 1.1.4: Faster, More Tests, Ready for 1.2

Category: Ajax, jQuery

In preparation for their upcoming jQuery v1.2 release next month, the jQuery team has released jQuery v1.1.4, an interim release which:

  • Increases selector performance
  • Includes an over-hauled test suite
  • Provides the ability to embed jQuery into the namespaces of other objects and libraries
  • Introduces the new method .slice() & new select :has()
  • Corrects some bugs

Of note is the library’s capability to rename itself:

Any Name jQuery

jQuery has taken a big step to become the first major JavaScript library completely capable of renaming itself. Previously, functionality was provided to rename the oft-used ‘$’ shortcut for ‘jQuery’ – but now you can also rename both ‘$’ and ‘jQuery’. This allows for two fantastic results:

* You can now include multiple versions of jQuery, simultaneously, on the same page.
* You can now embed jQuery into the namespaces of other objects and libraries, for example:

// With the Dojo Toolkit
dojo.jquery = jQuery.noConflict(true);
dojo.jquery(“#elem div”).slideDown(“slow”);
// or with Yahoo UI
YAHOO.query = jQuery.noConflict(true);

Posted by Rey Bango at 12:31 pm

4.1 rating from 77 votes


Comments feed TrackBack URI

We had had to do a workaround in our auto-login tool in order to compensate for this, so this was indeed a great fix and a time saver.

Comment by Tara Kelly — August 24, 2007

Sorry, I was totally unclear…

I was referring to the ability to embed jQuery into the namespaces of other objects and include multiple versions of jQuery on the same page.


Comment by Tara Kelly — August 24, 2007

What is the benefit of using mutiple versions of jquery?

Comment by Rizqi Ahmad — August 24, 2007

@rizqi: i guest it’s just possibility taken from this release :D

Comment by silent — August 24, 2007

@Rizqi: There’s no benefit, if you have complete control over a site. But if you work in a situation where you have no control over what else is in the site (which can frequently be the case in large corporations), you can now feel safe knowing that your copy of jQuery will still work.

Additionally, it’s good because you can now inject jQuery into any web site, and it’ll still work. (Some people have written Firefox extensions to inject jQuery into random web pages – so this will help them.)

Comment by John Resig — August 24, 2007

I love it when things I like get even faster! Mmm speed increase.

In the event that jQuery is written into say, Firefox extensions, or if jQuery is loaded with GreaseMonkey, and then you visit a webpage ALSO using jQuery, the namespace prevents collision. You could also run two versions of jQuery, i.e. a stable version and a beta, for testing on the same html/js without making two separate pages. Or if jQuery is written into a Widget, and that widget placed inside a page which uses jQuery…. The list goes on

Comment by Charles — August 24, 2007

$.fn.can = function() {return self}

now, we can work in style


i’ve always wanted to be able to do that. thank you jQuery!.

Comment by carmen — August 24, 2007

@carmen: :has() [not .has()] must be inside the $(), as seen below.

Together with the deep extend & noConflict, we can finally allow the ever popular:

/* jQuery lolcatz plugin 0.2b */
(function($) {
$.cheez = { taste: "delicious" };
$.extend(true, $, { cheez: { burger: "span" } } );
$$ = jQuery.noConflict(true);

$$( function() {
if ( $$('i.can:has(' + $$.cheez.burger+')' ) ) alert($$.cheez.taste);

Previously efforts to extend cheez on to burgers was destroying taste.
This plugin, soon to be released, allows guaranteed, no-conflict, cheezburger delivery.

Comment by Charles — August 24, 2007

We took the opportunity to step beyond any previously-released speed test suites and improve the speed of the three most commonly used portions of jQuery: ID selectors, tag name selectors, and each() loops:
$(”#id”) : 1676% faster
$(”elem”) : 295% faster
.each() : 554% faster

Damn $(“#id”) is 10 times faster?! How could you get any faster than document.getElementById?

Comment by Jordan — August 24, 2007

@Jordan: We can’t :-) Right now $(“#id”) is only about 10% slower than $(document.getElementById(‘id’)). And we really can’t get any faster than that (as we have to do a RegExp to verify the selector’s contents). I consider 10% to be a reasonable amount of overhead over pure DOM scripting.

Comment by John Resig — August 25, 2007

@John Resig:
Out of curiosity, are there optimizations for the case of getting just 1 element, such as: $(“”)? Or will jQuery get all $(“”) first and then pop the first element?

Comment by Jordan — August 25, 2007

Comment by Don — August 27, 2007

Don: wow, base2.DOM is the fastest one in IE7, Opera 9.2, Firefox 1.5 and Safari 3 here :|

Mister Edwards: let all the libraries accidentally steal your code please.. Or am I missing something?

Comment by Krijn Hoetmer — August 30, 2007

Leave a comment

You must be logged in to post a comment.