jQuery 1.2.6: Events 100% faster

Posted on by

jQuery 1.2.6 is primarily a bug fix release for jQuery 1.2. You can view the full list of what was fixed on the bug tracker.

This is the next release immediately following jQuery 1.2.3. Releases 1.2.4 and 1.2.5 were skipped (1.2.4 was built incorrectly, rendering it effectively identical to 1.2.3, and 1.2.5 was missing a patch).

The entire jQuery team did a fantastic job in pulling this release together – I want to take this opportunity to thank them all for their continued hard work.

I’d also like to take this opportunity to welcome Ariel Flesler to the core jQuery development team. He provided valuable help in pulling this release together – contributing bug fixes, performance improvements, features, and test cases. You can see the result of his hard work all throughout this release. Welcome Ariel and thank him for all his contributions!

Downloading

jQuery 1.2.6:

If you wish to checkout the full release from the Subversion repository, you can do so by following the instructions and checking out the source from the following location:

svn co http://jqueryjs.googlecode.com/svn/tags/1.2.6

Performance Improvements

Once again the jQuery team has worked hard to bring huge performance improvements in this release. As with previous releases we’ve expanded to look at many areas of the jQuery framework, looking for common pain points, and providing relief.

All data and test cases for the below performance improvements can be found in the the following jQuery 1.2.3 v. 1.2.6 Google Spreadsheet (results for Internet Explorer 6 were excluded in favor of Internet Explorer 7 due to their virtually-identical results).

Event Handling is 103% Faster

In analyzing intense application code (specifically operations such as drag-and-drop) we looked for ways in which universal changes could be made that would affect all users. A frequently-called piece of code was that of the jQuery event handler, any optimizations to it would dramatically improve the performance of all resulting frequently-called events. By focusing improvements here all frequently-called events that you have should see immediate benefits.

CSS Selectors are 13% faster

A number of optimizations have been made to internal jQuery methods, dramatically improving their performance, while providing measurable benefit to some of the most commonly used code in jQuery (such as the CSS Selector code).

For example the jQuery.map() method is now 866% faster and jQuery.extend() is 19% faster. These two changes have allowed for dramatic improvements in performance all throughout the library.

.offset() is 21% faster

Together with the improvements to jQuery’s event handling code optimizations of .offset() have allowed intense mouse-based operations to become much faster. For example jQuery UI’s drag-and-drop code is now over 300% faster because of these change (allowing you to achieve faster, smoother, drag-and-drop operations).

.css() is 25% faster

A method that’s frequently called (both internally and externally). The optimizations to this method are easily felt in others (like .offset(), for example).

New Features and Major Changes

Dimensions Plugin is Now Part of Core

The remaining methods of the Dimensions plugin, by Brandon Aaron, have been introduced into jQuery core, along with additional bug fixes and performance improvements. This plugin has seen considerable use amongst developers and plugin authors and has become a solid part of the jQuery ecosystem. We’ve been, slowly, introducing the most-used methods from the Dimensions plugin over the past couple releases – but with the release of 1.2.6 all remaining methods are now part of core.

If you’re upgrading your copy of jQuery to version 1.2.6 you can now opt to exclude the Dimensions plugin from your code.

The full documentation for Dimensions can be found on the jQuery documentation site (and is in the process of becoming integrated with the core jQuery documentation).

.attr() overhaul

The .attr() method has been completely overhauled (resolving about 15 outstanding bugs). Additionally, the method has been significantly simplified and optimized.

.toggle() can now accept more functions

Historically jQuery’s .toggle() function has accepted two functions (to be toggled in an even/odd manner). However that has been changed so that any number of functions can be provided and toggled by a mouse click.

$("div").toggle(function(){
  $(this).removeClass("three").addClass("one");
}, function(){
  $(this).removeClass("one").addClass("two");
}, function(){
  $(this).removeClass("two").addClass("three");
});

You can now unbind bound .toggle() and .one() functions

function test(){ $(this).addClass("test"); }
$("div").one("click", test);
$("div").unbind("click", test);

$("div").toggle(test, test);
$("div").unbind("click", test);

.index() supports jQuery collections

jQuery’s .index() function has allowed you to find the location of a DOM element in the jQuery collection – now you can also specify a jQuery collection (the first element of which will be extracted and located in the original set).

var test = $("div.test");
$("div").index( test ) == 3

jQuery.makeArray can convert ANYTHING to an array.

jQuery’s internal .makeArray() method now converts any array-like object into a new array. Additionally it wraps all other objects as an array and returns the resulting set.

jQuery.makeArray( document.getElementsByTagName("div") )
// => [ div, div, div ]

jQuery.makeArray( true )
// => [ true ]

jQuery.makeArray()
// => []

beforeSend can cancel Ajax calls

The beforeSend Ajax callback has allowed developers to execute a piece of code prior to a request occurring – now that code can also verify the integrity of some parameters and cancel the resulting Ajax request (useful for tasks like form validation).

$.ajax({
  beforeSend: function(){
    return $("#input").val() == "";
  },
  url: "test.php"
});

Exposed Speeds

jQuery has a number of named animation speeds (such as ‘slow’, ‘fast’, and ‘default’) you can now provide your own names for animation speeds, or modify the existing ones, by manipulating the jQuery.fx.speeds object.

jQuery.fx.speeds.slow = 1000;
$("#test").slideDown("slow");

111 thoughts on “jQuery 1.2.6: Events 100% faster

  1. Mike Gale on said:

    I’m intrigued by your way of measuring improvements.

    In my book 103% improvement in timing means that something finishes before you ask it to start.

    I assume your calculation involves taking the “after” time and dividing it into the “before” time then subtracting 100%.

  2. Pingback: AJAX Frameworks Update |

  3. hi i want to learn more about latest java scripts and how easily that implements and interacts with asp.net 2005

    send me some examples
    for making efective and faster my web applications.

    i m currentely as a programmer in krish compu soft pvt. ltd

  4. Pingback: » WordPress 2.6 Beta 1 boren.nu

  5. Pingback: Download now - Wordpress 2.6 is out now for Beta 1

  6. Pingback: WordPress 2.6 Beta 1-TurkForum.Net

  7. Pingback: Wordpress versi 2.6 beta 1 sudah rilis | KopiOnline.com

  8. Pingback: わーどぷれすっ! » WordPress 2.6 ベータ 1

  9. Pingback: WordPress 2.6 Beta 1

  10. Pingback: WordPress 2.6 Beta 1 | protusi

  11. Pingback: WordPress 2.6 Beta 1 | FlishFun.com

  12. Pingback: WordPress 2.6 Beta 1 | Tadd Mencer

  13. Pingback: WordPress 2.6 Beta 1 - pestaola.gr blog

  14. Pingback: Wordpress 2.6 bata1版本 新功能详解 | 帕兰映像

  15. Pingback: WordPress 2.6 Beta 1 erschienen | Caschys Blog

  16. Pingback: iTechnologize » WordPress 2.6 Beta 1

  17. Pingback: Bitácora de Gesbit

  18. Pingback: BlogTuga | Wordpress 2.6 Beta 1

  19. Pingback: Wordpress 2.6 New Under The Hood Features - ShoeMoney®

  20. Pingback: Wordpress 2.6 Beta 1 | WordPress-PT

  21. Pingback: WordPress 2.6 Right Around The Corner | Jeffro2pt0

  22. Pingback: Релиз Wordpress 2.6 beta1 | Вебмастеру посвящается...

  23. Pingback: Download bản WordPress 2.6 Beta 1 | Việt Tutorial [Viettut.info]

  24. Pingback: WordPress 2.6 Beta 1 at WordPress 2.6 Beta 1

  25. Pingback: 空想枫 - WordPress 2.6 Beta 1发布

  26. Pingback: Вышел релиз Wordpress 2.6 Beta 1 | SocialTrend

  27. Pingback: Gabfire web design » The steps of WordPress 2.6

  28. Pingback: Wordpress 2.6 com grandes melhorias | Wordpress Love - Themes, Plugins e tudo para Wordpress, em Português

  29. Pingback: WordPress 2.6 Beta 1 | Open Mania

  30. Pingback: WordPress 2.6 le ultime novità » Archivi Blog » WordPress Italy

  31. Pingback: WordPress 2.6 Adds All the Extra Goodies | Green Mountain Geek

  32. Pingback: Dicas Weblogs » WordPress 2.6 - O que tem de bom?

  33. Pingback: MoehBlog.de> » Neuerungen in WordPress 2.6 - Zu oft was Neues

  34. Pingback: WordPress最新版本 | 狂舞网络

  35. Pingback: Чем же хорош WP 2.6? Тестируем beta 1 | InGeekLog: Блоггинг как стиль жизни

  36. Pingback: Wordpress keeps going, WP 2.6 is well on it’s way | nomad-one consulting

  37. Pingback: Wordpress 2.6, chi lo aspetta con me? | Cabrino Simone’s Blog

  38. Farrukh Momin on said:

    Really impressed with your efforts and the big community you having with jquery. no doubt jquery is the best. i am using prototype and i am a big fan of it but still i am having very good experience with jquery too.

  39. Pingback: ocean90’s weblog » Wordpress 2.6 RC1 erschienen

  40. Pingback: Релиз WordPress 2.6 - что нового ? | Analyse|that

  41. Pingback: WordPress Tweaks » Blog Archive » WordPress 2.6 Beta 1

  42. Pingback: Softonix.com » Blog Archive » WordPress 2.6 Beta 1

  43. Pingback: Wir fahren mit Wordpress 2.6 | Promoter Blog

  44. Pingback: FunBlog :: Grab The WordPress 2.6 Final Version Now! :: August :: 2008

  45. Pingback: PHP Blogger: +++ Updates +++ Updates +++ - Ein PHP Blog auf deutsch

  46. Liona Berani on said:

    Recently go on the Internet TV channels I stumbled upon on this and am happy to provide it to you. I was surprised, but the channel was obsolyutno free 24 / 7. Watch and enjoy.
    Look TV Video

  47. Really impressed with your efforts and the big community you having with jquery. no doubt jquery is the best. i am using prototype and i am a big fan of it but still i am having very good experience with jquery too.