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. jQuery 1.1.4 tests don’t even run…

    http://EddieMaddox.com/jQuery/ …1.1.4…/test/
    “Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.6)
    Gecko/20070802 SeaMonkey/1.1.4
    Tests completed in 7 milliseconds.
    0 tests of 0 failed.”

    Shouldn’t that “of 0” be greater than zero?

    Thanks,
    Eddie

  2. Pingback: blogschau :: alles feine » Blog Archive » jquery - neue version

  3. Pingback: jQuery 1.1.4 liberada

  4. John Resig Says:
    August 29th, 2007 at 1:19 pm
    @Eddie: You need to include the src directory
    along with the test directory,
    otherwise no tests will run.

    John,
    I found an “src” directory here:
    http://dev.jquery.com/browser

    However, I cannot find any “src” here:
    http://docs.jquery.com/Downloading_jQuery
    or here:
    http://jquery.com/blog/2007/08/24/jquery-114-faster-more-tests-ready-for-12/
    or here:
    http://EddieMaddox.com/jQuery/jquery-1.1.4-release%20Folder/

    Furthermore, there is no HOWTO-run-the-tests.html
    in the “test” or “docs” directory clarifying anything.

    I noticed the use of “make” to generate various deliverables.
    Perhaps “make src” is missing as a deliverable.
    Could that be added so people like myself can run those tests,
    both nightlies and releases? In other words, “make” this just Work?:
    http://EddieMaddox.com/jQuery/jquery-1.1.4-release%20Folder/test/

    Thank you,
    Eddie Maddox

  5. Pingback: jQuery: mai aproape de 1.2 | CNET.ro

  6. frankysanders on said:

    I’m still having problems with jquery and evalScripts. I am aware that evalScripts has been deprecated but it doesn’t appear that calling .html on a jquery object is working as expected. There are essentially two cases for parsing javascript.

    1)Inline alert(“hello”);
    2) and external src =

    I’ve noticed that evalScripts used to look for both of these instances and handle them appropriately.

    evalScripts: function() {
    return this.find(“script”).each(function(){
    if ( this.src )
    jQuery.getScript( this.src );
    else
    jQuery.globalEval( this.text || this.textContent || this.innerHTML || “” );
    }).end();
    }
    The new version of jquery claims that evalScripts is no longer needed, however this only seems to be the case for Firefox.

    Why not have the evalScripts method combined with the method that renders HTML from ajax calls? i.e. after calling innerHTML call evalScript on the element. To work around this bug i’ve changed my application from:

    $(“#myId”).html(result);

    to

    document.getElementById(id).innerHTML = result;
    $(“#myId”).evalScripts();

    and reverted back to jquery 1.1.2.

    Does anyone have any insite on this or any plans to fix this in the next release?

  7. i can not use the plugin’s jQuery.iDrag of the interface.js under 1.1.4, but it worked good under 1.1.3.

  8. frankysanders on said:

    @John Resig

    I have confirmed that IE and 1.1.4 have an issue with putting script tags in side of DOM elements. Specifically jquery does not parse these tags in ie when rendering ajax results. Is there any chance this will be fixed soon? Or should I byte the bullet and just change and move all of my script tags outside of DOM elements? (painful work, but maybe necessary)

  9. Pingback: Juxtaviews - » Weekly Roundup - 08/31/07

  10. hcabbos on said:

    The test suite at http://jquery.com/test/ produced the following on a Mac (933mhz G4 1.5gig ram). Shown slowest to fastest:

    Firefox: 86351 milliseconds
    Opera: 64379 milliseconds
    Camino: 64184 milliseconds
    Safari (3.0.3): 32827 milliseconds

  11. http://jQuery.com/test/

    Mac G3, OSX 10.3.9…

    “jQuery Test Suite
    Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.6)
    Gecko/20070802 SeaMonkey/1.1.4

    Tests completed in 150268 milliseconds.
    0 tests of 816 failed.”

    Now, if only /test/ worked that easily
    straight from the “.zip” after unpacking…
    http://EddieMaddox.com/jQuery/jquery-1.1.4-release%20Folder/test/
    “jQuery Test Suite
    Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.6)
    Gecko/20070802 SeaMonkey/1.1.4

    Tests completed in 7 milliseconds.
    0 tests of 0 failed.”

    Thanks, hcabbos,
    Eddie Maddox

  12. RussianDev on said:

    Пиздец испанцы охренели! Давайте тоже писать на русском.

    Thanx for this release!!!

  13. Pingback: » jQuery 1.1.4, sempre meglio! » Full(o)bloG

  14. Pingback: RIABG.org » jQuery 1.1.4

  15. Tests completed in 71047 milliseconds.
    1 tests of 816 failed.
    RussianDev: Здесь некоторий сможет понемат твои слова.

  16. On my MacBookPro with OSX 10.4 (up to date) and Safari 2.0.4 (419.3) the testsuite crashes the browser near “core module: attr”.

  17. Pingback: John Resig - Non-Stop jQuery

  18. Pingback: Programming top DIGG news » Blog Archive » jQuery 1.1.4: Faster, More Tests, Ready for 1.2

  19. Pingback: jQuery 1.1.4: Faster, More Tests, Ready for 1.2 « Programming News

  20. Pingback: My Cup of Java - Today’s Top Blog Posts on Java - Powered by SocialRank

  21. Pingback: jQuery 1.1.4: Faster, More Tests, Ready for 1.2

  22. I seem to have a problem with every release after 1.1.3.1

    I’m loading a URL in a Thickbox(iframe). The iframe contains a text field which uses the jQuery Suggest plugin (which BTW should be cleaned up, extended a bit and brought into the official plugins because it simply works…). In Firefox, I get the following error as soon as the iframe content is finished loading :

    document.defaultView.getComputedStyle(h, null) has no properties (on jquery.js line 11)

    The weird thing, is that if I simply reload the iframe, the error doesn’t happen… Everything works fine once the iframe is reloaded. If I open the iframed URL in its own window, everything’s fine on first try (no reload needed)…

    I went back to 1.1.3.1 and I don’t get the error. Is there anything I can do to be able to use at least 1.1.4?

    Thanks!!

  23. Pingback: John Resig - I Learned Some Things About jQuery Today

  24. Just discovered a complete list of all marked down products at Amazon, sorted by category
    and % off, ranging from 50% off to 90% off (thanks Sonja for the effort).

    Actually I never thought Amazon would have articles with 90% off, but only in the category
    Electronics there are more than 3000 of them – look for yourself, the list is on
    Bargain Hunter (which is a blog of a woman who specializes in finding good deals at
    Amazon, like Britain’s “Jeanie”).

  25. Pingback: Jquery 1.2新特性 | 虾米窝窝

  26. kauf budget-worthdest viagra medication
    Buy bargain-penaltyd generic viagra tranquillizers
    viagra buy viagra budget-penaltydest viagra generic viagra viagra forum budget-assayd viagra viagra online buy viagra online
    viagra tranquillizer viagra powerlessness tranquillizer eli lilly co buy viagra in the uk viagra generic indian dispensary generic viagra
    viagra uk viagra canada online chemist’s shop viagra rss fodder viagra viagra levitra viagra lowest worth viagra for arrange
    lowest worths for viagra viagra levitra sales viagra viagra overnight

  27. Se dico AMAREZZA cos ?? la prima cosa che vi viene in mente?mi son fatto da mangiare, ho spento il fornello e subito toccato con la mano il pezzo di ferro tra il fornello e la padella per sistemarlo ben!e aaahhhhhhhhhh

    risultato: sono 2 ore che ho le dita nel ghiaccio e appena le tolgo mi bruciano da morire!!!!

    ke fare oltre a tenerle nel ghiaccio?

    considerando ke ho 24 anni e nn 3, qnt sono intelligente??
    scrivo con l altra mano, ne ho due IO
    domani in farmacia? io veramente spero mi possa passare tutto tra qlk oretta…
    cmq grazie a tutti
    mmm bruuucia ankora…
    chat

  28. Каждый человек мечтает о личном жилье или машине. Именно поэтому кредитование является все более популярным явлением. Для многих это является на сегодняшний день единственным методом получения собственного жилья или автомашины. Но также много разговоров о том, что кредитование не выгодное дело. На нашем познавательном сайте Вы узнаете о том, как законно оформить ипотеку, от чего зависит сумма, типах кредитов, законах о кредитовании, процессе получения кредита и многое другое.

  29. Доброго времени суток, форумчане сайта jquery.com ;)

    Ответьте мне, пожалуйста, на несколько вопросов…
    – какая программа умеет автоматически за НЕСКОЛЬКО СЕКУНД регистрировать ящики на mail.ru и многих других почтовиках?
    – какая программа умеет автоматом рассылать по mamba.ru и loveplanet.ru по заданным параметрам, при этом еще поддерживая функции автоответчика?
    – а также сможет разослать по форумам текст (например) “где купить валенки?”, а потом в ответ на этот текст ОТ ДРУГОГО имени и IP написать (например) “только на сайте megavalenki.ru!”?
    – плюс распознаёт картинки и вопросы а-ля “что написано на этой картинке?”, “сколько будет 2+2?” и “какой сейчас год?” и умеет корректно на них отвечать?
    – какая программа сможет разослать топики по форумам, попутно автоматически регистрироваться на них и создавая подробный отчет о проделанной работе?
    – и при этом работает с разнообразными движками – phpBB, VBulletin, IPB, ExBB, Icon Board, YaBB, UltimateBB, множеством различных гостевых, досок и блогов?
    – какую программу вы МОЖЕТЕ переделать под свой вкус?
    – какая программа автоматически обновляет прокси / SOCKS, обеспечивая вам полную анонимность? (достаточно просто нажать ОДНУ кнопку)
    – какая программа умеет рассылать персональные сообщения всем пользователям форумов phpBB, IPB, VBulletin?
    – какая программа отсортирует Вашу базу ссылок по Google PageRank?
    – какая программа МАССОВО отредактирует все Ваши ранее разосланные объявления по форумам?
    – и при этом еще регулярно обновляется и совершенствуется.

    Ответ ОДИН: всё это и многое другое под силу программному комплексу XRumer 4.085 Platinum Edition + Hrefer 2.85
    Данный комплекс имеет множество отзывов на авторитетных источниках (Washington Post, Wikipedia и т.п.), имеет историю активного развития более 3-х лет.

    Just Google! ;)

    См. также: чёрное СЕО, распознавание текстовой защиты, SEO, black SEO, XRumer 3.0 устарел, дорвеи, программы для СЕО, софт для СЕО, рассылка по форумам, ППЦ, софт для SEO, белое СЕО, постинг по блогам, PPC, программы для SEO, doorways, мощная спамилка, массовые рассылки, разослать по форумам и гостевым, XRumer forever, постинг, распознавание графической защиты, распознавание капчи, линкспам, XRumer 2.9 устарел, хрумер 2.9 устарел, рефспам, хрумер, хрумер 3.0 устарел, XRumer, суперсофт для SEO, СЕО

  30. Pingback: web-1-8

  31. Рано или поздно у каждого человека возникает вопрос о продаже, покупке или аренде жилья. Чтобы грамотно заключить сделку и получить от нее выгоду, следует разбираться в тонкостях этого вопроса. Сайт agened.ru – это Ваш надежный помощник во всех операциях с недвижимостью. Узнайте о том, как не стать жертвой мошенников, какие подводные камни ждут Вас при покупке жилья на вторичном рыке жилья, кто такие маклеры и многое другое.

  32. mbadmin.ru on said:

    Ð’ наше время быть Магистром бизнес-администрирования (MBA) – это не всего лишь престижно, но и достаточно прибыльно. Самая интересная профессия в сфере бизнеса может стать Вашей. Улучшить свое благосостояние и приобрести востребованную как за рубежом, так и у нас профессию – возможно уже сегодня. Подробная информация об учебных заведениях, формах обучения, тесте GMAT, рейтингах, условиях поступления на проекте mbadmin.ru. Обеспечьте себе достойное будущее уже сегодня!

  33. Наш сайт создан для тех, кто не желает провести значительную часть своей жизни, выстаивая длинные очереди за билетами. У нас бы можете заказать нужный билет по телефону или в режиме он-лайн. Вы можете заказать билеты на чартерные и регулярные рейсы, билеты на поезд, заказать номер в гостинице и узнать о правилах бронирования. В случае, если Вы потеряли персональный билет или хотите внести изменения в заказ, мы поможем Вам в этом. Путешествуйте комфортно сообща с нами.

  34. Мечтаете о новом автомобиле, но не можете уплатить сразу полную сумму. Не проблема! Автокредит дает возможность каждому приобрести автомобиль и осуществить свою заветную мечту. Выберете наиболее рациональный для Вас автокредит, и уже завтра Вы сможете прокатиться в долгожданном авто. Проект cartcredit.ru поможет Вам разобраться во всех нюансах автокредитования, программах кредитования, определиться с выбором банка и приобрести машину за 30 минут.

  35. Рынок контактных линз постоянно меняется и меняется. На сегодняшний момент ассортимент контактных линз достаточно велик, есть большое количество дизайнов, материалов, режимов ношения. Однако наличие большого выбора обуславливает и некоторые трудности как для врача-контактолога, так и для пациента – им часто трудно остановить выбор на конкретном типе контактных линз. Мы поможем Вам сориентироваться в преимуществах линз, видах линз, научим, как грамотно за ними ухаживать на visioneys.ru