jQuery 1.1.4: Faster, More Tests, Ready for 1.2

Posted on by

We’re pleased to announce the latest release of jQuery: jQuery 1.1.4. Barring any horrible mistakes, this release will be the last of the 1.1.x branch – leading us up to the release of jQuery 1.2 in September.

You can download the release from the jQuery Google Code page:

Download:

Improvements

A number of improvements have gone into this release, in addition to all of the normal bug fixes.

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);
    YAHOO.query("span.hidden").removeClass("hidden");

Speed Improvements

What would a release be without some speed improvements? 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. It’s absolutely critical that each of these items are made as fast as possible, as they have the possibility of being re-used endlessly, and repeatedly.

Here’s the test suite used to analyze the speed of the three changes.

$(“#id”) Improvements

Browser jQuery 1.1.3 jQuery 1.1.4 % Improvement
IE 6 651ms 70ms 830%
Firefox 2 1355ms 27ms 4919%
Safari 3 101ms 14ms 620%
Opera 9 270ms 62ms 335%
Average improvement: 1676%

$(“elem”) Improvements

Browser jQuery 1.1.3 jQuery 1.1.4 % Improvement
IE 6 661ms 451ms 47%
Firefox 2 1717ms 143ms 1100%
Safari 3 99ms 83ms 19%
Opera 9 226ms 198ms 14%
Average improvement: 295%

.each() Improvements

Browser jQuery 1.1.3 jQuery 1.1.4 % Improvement
IE 6 200ms 30ms 567%
Firefox 2 468ms 29ms 1514%
Safari 3 17ms 11ms 54%
Opera 9 45ms 25ms 80%
Average improvement: 554%

Test Suite Overhaul

This is very big news – and should be especially so to most developers out there. The jQuery test suite has been completely re-tooled and improved from the ground up for stability. A brand new swath of Animation and Ajax tests have been integrated bringing jQuery’s total test count to over 800 tests!

Additionally, the test suite completely passes with no errors in all the major browsers that we support: Firefox 2, Safari 3, Internet Explorer 6, and Opera 9 (Safari 2 and IE 7 not shown for brevity). Proof:

In the future, we’re working to improve our coverage of the Event, Attribute, and CSS portions of jQuery – undoubtedly bringing us to over 1000 tests very soon.

Additionally, it should be noted that the jQuery test suite is now embedded in the Mozilla test suite – running against every commit of the upcoming Firefox 3 release. You can feel safe knowing that in the newest release of Firefox, everything will just keep working, as you would expect it to.

Bug Fixes

53 tickets have been closed for this release. You can read the full details on the the bug tracker (this includes fixes that went in to jQuery 1.1.3.1).

A bunch of large issues were resolved, including issues related to HTML script evaluation, Safari CSS Computed Style access, and Ajax settings manipulation.

New Functionality

A couple pieces of new functionality have been introduced. The first two of which, .slice() and :has(), are going to be a part of jQuery 1.2, but their existence is obligated by some deprecated functionality (see below). The new changes to extend() and noConflict() were put in order to be able to fix some long standing bugs in jQuery.

.slice()

You may recognize this method name from the .slice() method that exists on JavaScript arrays – you’re in luck because it behaves identically. This is a great method for chopping apart jQuery objects and getting to the elements inside of them. All of the following are valid ways to use the slice() method:

$("div").slice(0,1); // First div
$("div").slice(-1); // Last div
$("div").slice(1,-1); // All divs but the first and last
$("div").slice(1,3); // The second and third div
$("div").slice(7,8); // The eighth div

:has()

This new selector is a replacement for the current way of checking for elements inside of another element (div[p]). You can now use this selector just as you would that particular XPath selector, like so:

// All divs with a paragraph inside
$("div:has(p)")
// All anchors with an image inside
$("a:has(img)") 
// All divs that have an anchor inside that have an image inside
$("div:has(a:has(img))")

Deep, recursive .extend()

This has been a frequently-requested addition to the jQuery .extend() method. This change allows you to deeply merge nested objects (as opposed to having them overwrite each other). This is best demonstrated through an example:

// Normal .extend()
jQuery.extend(
  { name: "John", location: { city: "Boston" } },
  { last: "Resig", location: { state: "MA" } }
);
// Result:
// => { name: "John", last: "Resig", location: { state: "MA" } }
// New Deep .extend()
jQuery.extend( true,
  { name: "John", location: { city: "Boston" } },
  { last: "Resig", location: { state: "MA" } }
);
// Result:
// => { name: "John", last: "Resig",
//      location: { city: "Boston", state: "MA" } }

.noConflict(true)

As described previously, this addition to .noConflict() allows you to completely rename both the ‘jQuery’ namespace and the ‘$’ shortcut, while also rolling back any changes those introductions may have done. You can use this new shortcut like so:

// Give jQuery a custom name:
var jq = jQuery.noConflict(true);
jq("#id div").hide();

// Both Fail - $ and jQuery have been renamed:
$("#id div").hide();
jQuery("#id div").hide();

This trick can also be used to push jQuery into an existing namespace, like so:

// Put jQuery in a namespace:
var obj = {};
obj.jq = jQuery.noConflict(true);
obj.jq("#id div").hide();

Deprecated Functionality

We are deprecating a number of methods in jQuery 1.1.4 in preparation for the API changes in the upcoming jQuery 1.2. Wherever possible, we’ve provided alternate methods for performing actions.

With jQuery 1.2, as with the jQuery 1.1 release, a backwards compatibility plugin will be provided. Thus, if you wish to continue using these particular techniques, you’ll be able to use that plugin and continue doing so.

Additionally, in order to handle the XPath changes another, separate, plugin will be released that will handle XPath selector functionality in jQuery. This plugin will be made available along with the jQuery 1.2 release.

Selectors

$("div//p") XPath Descendant Selector
Please use the CSS $("div p") selector instead. Or, when jQuery 1.2 is released, use the new XPath Plugin.

$("div/p") XPath Child Selector
Please use the CSS $("div > p") selector instead. Or, when jQuery 1.2 is released, use the new XPath Plugin.

$("p/../div") XPath Parent Selector
Please use the $("p").parent("div") selector instead. Or, when jQuery 1.2 is released, use the new XPath Plugin.

$("div[p]") XPath Contains Predicate Selector
Please use the new $("div:has(p)") selector instead. Or, when jQuery 1.2 is released, use the new XPath Plugin.

$("a[@href]") XPath Attribute Selector
Note: While this selector is being deprecated in this release, it will not be removed in jQuery 1.2. Come jQuery 1.2, it’ll be recommended that you use the CSS selector $("a[href]") instead. Or, when jQuery 1.2 is released, use the new XPath Plugin.

DOM Manipulation

$("div").clone(false)
Calling the clone method with an argument is being deprecated (the clone method, as a whole, is being kept). Instead of calling .clone(false) you should now do: .clone().empty() instead.

DOM Traversal

$("div").eq(0)
This method is being deprecated for the use of the new .slice() method (which works identically to an array’s slice method. You can duplicate .eq() like so:

$("div").slice(0,1);

Additionally, .eq(0) can be duplicated in the following ways:

$("div:eq(0)")
$("div:first")

$("div").lt(2)
This method is being deprecated for the use of the new .slice() method (which works identically to an array’s slice method. You can duplicate .lt() like so:

$("div").slice(0,2);

Additionally, .lt(2) can be duplicated in the following way:

$("div:lt(2)")

$("div").gt(2)
This method is being deprecated for the use of the new .slice() method (which works identically to an array’s slice method. You can duplicate .gt() like so:

$("div").slice(3);

Additionally, .gt(2) can be duplicated in the following way:

$("div:gt(2)")

Ajax

$("#elem").loadIfModified("some.php")
This convenience method is being removed in favor of the long form use of $.ajax():

$.ajax({
  url: "some.php",
  ifModified: true,
  success: function(html){
    $("#elem").html(html);
  }
});

$.getIfModified("some.php")
This convenience method is being removed in favor of the long form use of $.ajax():

$.ajax({
  url: "some.php",
  ifModified: true
});

$.ajaxTimeout(3000)
This convenience method is being removed in favor of the long form use of the more-explicit $.ajaxSetup():

$.ajaxSetup({timeout: 3000});

$(...).evalScripts()
This method is no longer necessary in jQuery – all scripts included in HTML strings are automatically evaluated when injected into the document. No substitute method is needed.


As always, please let us know if you encounter any bugs in between jQuery 1.1.3.1 and jQuery 1.1.4. Thanks!

186 thoughts on “jQuery 1.1.4: Faster, More Tests, Ready for 1.2

  1. @qui est regex: You do realize that we don’t add functionality in minor releases, right? we only add new stuff in major releases? The methods that we added this time we necessary in order to transition people away from the deprecated methods – there’s no such case with regexp selectors.

  2. Hey this may be a bit off-topic, but I just watched your entire presentation of Javascript Libraries of about a week ago, John. It’s pretty impressive and I learned a lot from it, about Javascript but also about jQuery. Awesome release by the way.

  3. Have you bee ntested in IE 5/5.5 ? I have test page totally stopped on the point (test haven’t finished):
    88. ajax module: $.ajax – xml: non-namespace elements inside namespaced elements (0, 3, 3)
    3. things in responseXML: 2

    and I have also some errors in IE5.5 (I’m using MultipleIE pack)
    12. core module: attr(String) (2, 11, 13)

    12. Died on test #12: [object Error]
    13. Expected 13 assertions, but 12 were run
    22. core module: append(String|Element|Array|jQuery) (1, 17, 18)

    12. Test for appending a DOM node to the contents of an IFrame
    24. core module: prepend(String|Element|Array|jQuery) (1, 4, 5)

    2. Prepending html options to select element
    25. core module: prependTo(String|Element|Array|jQuery) (1, 5, 6)

    2. Prepending html options to select element
    31. core module: find(String) (1, 0, 1)
    1. Check for find
    39. core module: not() (1, 2, 3)

    3. Died on test #3: [object Error]
    59. selector module: element (2, 0, 2)
    1. Died on test #1: [object Error]
    2. Expected 9 assertions, but 1 were run
    61. selector module: broken (2, 0, 2)
    1. Died on test #1: [object Error]
    2. Expected 7 assertions, but 1 were run
    62. selector module: id (6, 16, 22)

    4. ID selector with existing ID descendant (#firstp #simon1) expected: [ a#simon1 ] result: [ ]

    8. Descendant ID selector using UTF8 (div #台北) expected: [ span#台北 ] result: [ ]

    12. Descendant escaped ID (div #foo\:bar) expected: [ span#foo:bar ] result: [ ]
    13. Descendant escaped ID (div #test\.foo\[5\]bar) expected: [ span#test.foo[5]bar ] result: [ ]

    21. Died on test #21: [object Error]
    22. Expected 24 assertions, but 21 were run
    63. selector module: class (2, 0, 2)
    1. Died on test #1: [object Error]
    2. Expected 16 assertions, but 1 were run
    65. selector module: child and adjacent (1, 18, 19)

    14. First Child (p:first-child) expected: [ p#firstp, p#sndp ] result: [ ]

    66. selector module: attributes (2, 1, 3)

    2. Died on test #2: [object Error]
    3. Expected 20 assertions, but 2 were run
    67. selector module: pseudo (:) selectors (3, 22, 25)
    1. First Child (p:first-child) expected: [ p#firstp, p#sndp ] result: [ ]

    24. Died on test #24: [object Error]
    25. Expected 30 assertions, but 24 were run
    68. selector module: basic xpath (2, 0, 2)
    1. Died on test #1: [object Error]
    2. Expected 17 assertions, but 1 were run
    74. ajax module: serialize() (1, 0, 1)
    1. Died on test #1: [object Error]

    It’s may be not so actual for US, but in other countries IE 5/5.5 is still a bit popular…

    Also I’ve noticed that there are only 745 completed tests in Safari 3 Win (of 816 in all the other borwsers). Can you describe this issue?

    Thank you a lot

  4. John,

    I was reading your jQuery 1.2 Roadmap and noticed that you mentioned the possibility of including livequery into jquery if you saw a more widescale adoption of its use. Well, I’m here to testify that it is a main file included on every page of the enterprise-level site we’re building.

    I was starting to get sick of writing initialize $.fn’s and livequery saved the day. After using the selector to bind an event to what is matched, there are many instances in which we Ajax in new content that needs the same event applied after DOM has loaded. Without livequery, we have to reassign events to the Ajaxed content. Of course my only concern is the eventual need for garbage collection on event triggers never used during the page view, but I’m sure some genius will come up with a plan for that.

    If adding livequery to jQuery means I save a couple of bytes of overhead for file inclusion and overall filesize, I say “do it!”

  5. By the way. I can’t thank you enough for jQuery. It has opened the doors for many possibilities and lent me the ability to create feature-rich applications I couldn’t have done with simply reading DOM javascript books.

    Thanks again.

  6. Pingback: jQuery 1.1.4 out « grahaNa

  7. Pingback:   jquery 1.1.4 hazır by Ozdemir.CC - KiÅŸisel Sitem

  8. Pingback: jQuery 1.1.4 Released

  9. Pingback: Fatih HayrioÄŸlu’nun not defteri » 25 AÄŸustos 2007 Web’den Seçme Haberler

  10. Pingback: Weekend Links - jQuery 1.4, CSS Images, Printing Techniques, Converting to CSS, Cross-Browser Coding | BluDice Blog :: PHP, MySQL, CSS, Javascript, MooTools, and Everything Else

  11. Pingback: Webciyiz - Webmaster Kaynakları » jquery 1.1.4 hazır

  12. Pingback: davjef.com » Blog Archive » jQuery 1.1.4 Release

  13. Pingback: Entradas en las blogosferas.14 - Carrero Bitácora de los Hermanos Carrero, David Carrero Fernández-Baillo y Jaime Carrero Fernández-Baillo.

  14. Pingback: TerryH Blog 雲 >>> » Blog Archive » jQuery 1.1.4 Out

  15. Pingback: jQuery 1.1.4 发布了! « Justin’s Tech Blog

  16. Pingback: t8d blog » Blog Archiv » jQuery 1.1.4 erschienen

  17. Pingback: Новый релиз jQuery - 1.1.4: фантастическое ускорение! » Wake Up!

  18. 不知道为什么,自从1.1.3到1.1.3我在使用slidedown函数时,总会产生颤动(滑动不是很稳定,虽然只有开始的一下,他先显示出全部的内容,然后又从最小开始下滑)的情况,而1.1.2却没有这个情况

  19. sorry,是1.1.3到1.1.4都有问题,而且是slideup,down没有任何问题

  20. Pingback:   jQuery 1.2准备就绪 by The Third Part

  21. Denis Ignatenko on said:

    @MikeChristensen
    >>Well , I’m here to testify that it is a main file included on every page of the enterprise-level site we’re building.
    If you need some plugins with core lib, so why not to build jQuery and livequery together in a single file? As for me I see no reason for merging.

  22. frankysanders on said:

    I too seem to be having issues with IE 6.0 and evalScripts.

    I had to write a little hack.

    $(“#” + id + “”).html(result);
    if(getBrowser == “msie”){
    $(“#” + id + “”).evalScripts();
    }

    I’ve tested this as follows:
    1) create an ajax chunk

    function test(){
    alert(1);
    }
    test();

    Try to load this via the .ajax method and the alert will not be executed in IE 6. I am not currently able to test this in IE 7 but I suspect similar behavior.

  23. Pingback: Slickspeed | Lvx ex Cælis

  24. frankysanders on said:

    I’ve moved some code around and all seems to be good now. I am not sure what fixed it but this bug no longer is affecting my application.

  25. AjaxDev0008 on said:

    @frankysanders
    Can you post the changes you made to your code to make the .Ajax bug go away?

  26. Pingback: jQuery 1.1.4: Faster, More Tests, Ready for 1.2 « 高清生活 living HD

  27. Ariel Flesler on said:

    @MikeChristensen:
    The re-binding problem you mention, can be easily avoided using event delegation, jquerylive is a great plugin but you can just bind functions to the containers, that don’t get refreshed with ajax calls and that will work just fine.
    I posted a small plugin for event delegation, it’s called Intercept. It’s pretty simple right now, maybe it helps you out.

  28. IN IE7

    $.ajax({ url:”test.html”,
    ifModified: true,
    success: function(msg){
    $(“#output1”).html(msg);
    }
    });
    —-> erreur cause of this $(“#output1”).html(msg); : Could not complete the operation due to error 8002001
    When i change $(“#output1”).html(msg); for $(“#output1”).text(msg); it works, but there are many html balise ………..

    so is 1.1.4.1 have a probleme with .html ?

  29. Pingback: Apis Networks Community Updates » esprit Updates, Initial Backup Runs, and Mailbox Routes policy changes

  30. Daniel Lin : with fiddler i can see the response, and it’s ok
    but nothing appear in the div. actually, it empty the div

  31. Pingback: Novedades en jQuery 1.1.4 - Scriptia

  32. Pingback: jQuery 1.1.4 Released | ...himerus

  33. I’m amazed at the noted speed improvements. I’m really looking forward to testing out the new version. Should get it up and running this evening.

    I’m just getting into jQuery, and I’m in love with the ease of use and understanding, and I’ve been writing PHP code for 10 years, and various javascript / DOM stuff when needed. jQuery seems to be the simplest library to set up and implement features with for the beginner or expert programmer alike…
    Keep up the good work, and I’m going to keep learning, and figure out how to push the jQuery library to it’s limits. :D

  34. The new version is much faster. Noticeably so. Although I have a bug for IE7. Works fine in FF.
    When returning html after an ajax call:

    function af_matter(mid)
    {
    var dt = $(“#mform”).formSerialize;
    $.ajax({type: “GET”,
    url: “ajax/homeAjax.php”,
    data: dt+”&mid=”+mid,
    success: function(z){$(“#mymatt”).html(z);} });}
    }

    It returns the html and then appends it with the last character in the data returned (it’s an auto-complete form, so the last character of the last word returned is appended to the end of the html). Can’t figure out why. Here is what is being returned:

    (PHP snippet)

    There is a while loop that builds this, and then echo’s it out.

    $row[1]
    $row[2]

    So if $row[2] is “Johnson”. It will return the whole list + the “n” from johnson underneath it.
    Sorry for posting it on here. I tried to post it in the bug section, but I couldn’t register or login.
    Using the ajaxform plugin and the masked input plugin. Have removed both to see if the caused any errors, and the issue persisted.
    This worked great in 1.1.3. Anyone else seen this?

  35. Pingback: iHao Press » jquery 1.1.4 release

  36. AjaxDev0008 on said:

    @frankysanders
    @John Resig
    Subject .Ajax/evalScripts() issue

    We tracked down the issue and the meaning behind frankysanders comment above. The script tag in the page to be loaded by $.Ajax cannot be a child element of any html object (div, span, etc) in IE. In FF this is not an issue, the script tag can be anywhere. Other than this inconsistency the release has been great.

    Will this be resolved in the next release?

  37. Halmat Ferello on said:

    This bit of code now fails on IE7

    $(‘a.bold-chat’).each(function(index) {
    this.href = this.href + ‘&url=’ + escape(document.location.href);
    });