jQuery 1.1.3: 800%+ Faster, still 20KB

Posted on by

I’m pleased to announce the release of jQuery 1.1.3. After many months of testing, developing, and more testing, we have a very solid release available for download. It comes with roughly 80+ fixed bugs and a handful of enhancements for good measure. Highlights include:

  1. Improved speeds, with DOM traversal over 800% faster than in 1.1.2.
  2. A re-written event system, with more graceful handling of keyboard events.
  3. A re-written effects system (with an accompanying fx test suite), featuring faster execution and better cross-platform support.

Update – July 4th: We just finished a quick bug fix release, versioned 1.1.3.1, which fixes a couple of outstanding issues.

Download:

As always, if you find any bugs with this release, please post them to the jQuery Bug Tracker.

1.1.3 Features

Massive Selector Speed Improvements

Due to popular demand, we dug deep and made some major changes to jQuery’s selector engine. Here’s a breakdown of the speed improvements that were made to jQuery itself. All numbers are based on the SlickSpeed test suite.

Browser jQuery 1.1.2 jQuery 1.1.3 % Improvement
IE 6 4890ms 661ms 740%
Firefox 2 5629ms 567ms 993%
Safari 2 3575ms 475ms 753%
Opera 9.1 3196ms 326ms 980%
Average improvement: 867%

Additionally, we tested the improved code base against some of the other popular selector libraries, again with the SlickSpeed test suite.

Browser Prototype jQuery Mootools Ext Dojo
IE 6 1476ms 661ms 1238ms 672ms 738ms
Firefox 2 219ms 567ms 220ms 951ms 440ms
Safari 2 1568ms 475ms 909ms 417ms 527ms
Opera 9.1 220ms 326ms 217ms 296ms 220ms

A couple things to notice when looking at the speed suite results are that:

  • We’re over 800% faster than we were in jQuery 1.1.2.
  • We’re the fastest framework in the most popular browser, Internet Explorer 6.
  • We’re the only framework that doesn’t give incorrect results.
  • And all of this comes at no expense to you — jQuery is still the same 20KB that you’ve come to expect and enjoy.

New Selectors

Unicode Selectors: This is a huge addition for those of you who want to use Unicode attribute values, IDs, class names, or tag names. You can now use them directly in jQuery selectors:

$("div.台北")
$("div#台北")
$("foo_bar台北")
$("div[@id=台北]")

Escape Selectors: A frequently requested feature you can now select elements by ID (or other selector) that uses a special character, for example this will find the div that has the ID of “foo.bar”:

$("div#foo\\\\.bar")

Inequality Selector: While this selector isn’t part of the CSS specification, it’s frequently used and included in other selector libraries, so we decided to add it in:

$("div[@id!=test]")

:nth-child() improvements: This selector allows you to locate specific child elements. We’ve supported selectors like :nth-child(1) and :nth-child(odd) since the beginning of jQuery, now we’ve added advanced :nth-child selectors, such as:

$("div:nth-child(2n)")
$("div:nth-child(2n+1)")
$("div:nth-child(n)")

Space-separated attributes: After being removed in jQuery 1.0, this selector has now been brought back by popular demand. It allows you to locate individual items in a space-separated attribute (such as a class or rel attribute).

$("a[@rel~=test]")

Animation Improvements

Speed: Animations are now significantly faster and smoother. Additionally, you can run more simultaneous animations without incurring any speed hits.

Testing: We now have a dedicated test suite for animations — which has allowed us to fix a number of pressing animation bugs that weren’t previously locatable.

DOM Event Listeners

Internally, the jQuery Event system has been overhauled to use the DOM Event system, rather than the classical “onclick” style of binding event handlers. This improvement allows you to be more unobtrusive in your use of the library (not affecting the flow of other libraries around it). Additionally, it helped to resolve some of the outstanding issues that existed with binding event listeners to IFrames.

Event Normalization

Some great steps have been taken to normalize keyboard and mouse events. You can now access the event.which property to get most details about the specific key or button that was pressed.

Multiple .is()

The .is() method can now take multiple selectors, separated by a comma. This allows you to test your jQuery set against multiple selectors.

$("div").is(":visible, :first")

Browser Version

A commonly requested feature, by plugin authors, was a way to determine what browser version their users were using. We now expose an extra property through which this information can be accessed.

jQuery.browser.version

More Bug Fixes

Please see the ticket listing for the full list of all issues resolved in this release.

The Future of jQuery

We’ve been very concerned with the direction and progress being made towards furthering the jQuery project. We’re focusing on a number of different aspects now, but the primary concern is still the advancement of the core jQuery library. We’ve spec’d out the next two releases, which you can read more about below:

jQuery 1.1.4

This will be the last release of the jQuery 1.1 branch – another bug fix release with some minor improvements. This release will also mark a number of methods as deprecated, in accordance with the upcoming jQuery 1.2 release.

We’re currently planning on having this release take place at the end of July.

jQuery 1.2

This will be the next major release of jQuery, containing a significant number of new features. The full details of this release can be found in the jQuery 1.2 Roadmap.

Your comments and feedback on this release are greatly appreciated. It’s still in planning, so nothing is completely final. We’re currently planning on releasing jQuery 1.2 by the end of August.

jQuery Books

We’re now up to 4 jQuery books being written and, just as importantly, they’re all being written by members of the jQuery team (so you’ll know that you’re getting good information).

The books and their authors are as follows:

  • Learning jQuery by Karl Swedberg and Jonathan Chaffer – due out early July 2007 (Packt Publishing).
  • jQuery Reference Guide by Karl Swedberg and Jonathan Chaffer – due out Summer 2007 (Packt Publishing).
  • jQuery Quickly by Yehuda Katz and Bear Bibeault (Manning Publishing).
  • Designing with jQuery by Glen Lipka (Manning Publishing).

This is really fantastic news. I’ve been able to read some of the pre-release chapters and I think you’re going to be in for a real treat with these books.

jQuery Talks and Conference

I’d like to announce some talks being given about jQuery in the upcoming months. Specifically, there will be a number of talks given about jQuery at both of the Ajax Experience conferences.

At the San Francisco Ajax Experience, John Resig will be giving an introductory overview to jQuery followed by an advanced jQuery talk. Glen Lipka will be giving a talk on designing with jQuery.

At the Boston Ajax Experience, John and Glen will be presenting again, and will be joined by Paul Bakaus to give a talk on developing intense applications and games with jQuery.

Since there’s going to be quite a few members of the jQuery team at the Boston Ajax Experience, we’d like to announce that we’re planning on doing a small, one day, jQuery Conference the next day after the Ajax Experience. This will be the perfect opportunity for you to meet the jQuery team and ask any nagging questions that you have. We’ll also be giving a number of talks about specific aspects of jQuery. We’ll have more details about this soon.

jQuery UI

Today, we’re also pleased to announce a secret project that we’ve been working on: jQuery UI. This project, being written by Paul Bakaus, is a whole new Drag & Drop library being developed from the ground up with speed and extensibility taken into consideration. Additionally, great care is being taken to have the code be fully documented and tested — allowing many other developers to use and help extend it.

This library will contain full code for Draggables, Droppables, Sortables, Resizables, and a Slider.

You can take a look at some of Paul’s early work in the SVN repository.

Funding and Thank You

The new jQuery UI library marks a new step for the jQuery project: This is a piece of code whose development we’re sponsoring using money donated by you, the jQuery users!

This is being made possible in two ways: first by your continued support and donations to the jQuery project, and second by a generous server donation by Media Temple. This is allowing us to focus our financial resources on other projects that’ll benefit everyone the most.

So I’d like to take this opportunity to request additional donations to help us continue funding exciting new work that you’ll be able to use in your web sites. Any help will be greatly appreciated.

Amount in $

Once again, I’d like to thank the jQuery team and everyone who has helped to make this release possible. It’s been a lot of work, but I hope you’ll be as pleased with this release as we are. Thank you — and thanks for using jQuery!

Visual jQuery Magazine: Part Deux

Posted on by

Those of you who have been around for a while know that in September of last year I published the first issue of the Visual jQuery Magazine. In October, the magazine was also released in French.

The mag had interviews with important jQuery community members (like creator John Resig, plugin editor Dave Cardwell, etc.), articles on jQuery features and implementations, and even a piece or two on alternate Javascript libraries, complete with quality graphics and original art.

The positive response was incredible, and people really seemed to like it. Unfortunately, though I’d initially planned on making the magazine a monthly publication, things fell to the wayside as my schedule got progressively more hectic. Since Issue 1 I’ve found a new job (new then; about eight or nine months old now), moved across the country (NY to CA), and gotten a huge chunk of the way through writing my first book (stay tuned for details!). Clearly, things have been busy.

The lack of Issue 2 has been bugging me since Issue 1, and I’ve decided it’s time to make it happen (this, I admit, is also largely in part to my good friend Rey Bango’s recently renewed effort to push jQuery forward). Thankfully, the magazine’s lead designer and the team of French developers/translators have all expressed an interest in helping make Issue 2 happen, which makes this goal a lot more tangible.

Issue 1 was an experiment, and it went really well. Since it was a first though, it was very much “the Yehuda show.” I’d like Issue 2 to be more of a collaboration of contributors; there are a lot of jQuery topics to explore, and a lot of team member and users with fascinating tales to tell.

As such, I’m putting the word out there. I’m looking for contributions for Issue 2 of Visual jQuery Magazine. Articles can vary in length extensively, from brief three paragraph shorts, to three page features. They can be tutorials, feature articles, interviews and lots of other things I’m sure you’ll all think of. Just a few brief (and somewhat flexible) guidelines:

  • The article must be in magazine or newspaper format (if, in fact, your submission is a piece of writing — illustrations will also be considered). I’m extremely lax on this, but it should be something you could see being in a magazine.
  • The article must be about a topic that is timely and pertinent to the jQuery community, with broad appeal.
  • The article must not be an advertisement (but it may, obviously, feature a plugin you have written if it has broad appeal).
  • The article must be factually correct.
  • The magazine staff will edit your article for grammar, space, and style. You will receive an edited copy prior to publication for approval.
  • The magazine staff will add graphics and other visual elements as appropriate.
  • Please email a proposal or brief description of your submission before spending a chunk of time working on it; that way we can avoid running out of space and ensure that everything print-worthy gets in. Email submissions and letters to the editor to editor AT visualjquery DOT com.

    As I said from the beginning of this project, I think that the magazine has real potential to open up the jQuery world to new users, and hope that by pushing the envelope of community-produced content, we can keep jQuery moving forward in it’s current positive direction. I, for one, I’m really excited about it.

    I will also be accepted advertisements, with all proceeds to go to the jQuery project. If you’re interested, please email me!

    New Plugin Repository

    Posted on by

    jQuery Plugin Repository

    One of the great aspects of jQuery is its extensibility, as evidenced by the many excellent plugins that have been developed for it. The jQuery team, and the Web team in particular, have been working hard behind the scenes to put together a repository to showcase these plugins.

    The new repository comes with a few features that are sure to help users to find what they’re looking for and determine which plugins will best suit their needs. There’s the (jQuery-based) ratings widget to let you know how highly others value each plugin. The ratings are viewable by all, and you can rate them yourself by simply registering on the site with a user name and email address. You’ll also have easier access to change logs, demos, and documentation, as well as bug reporting and feature requests.

    There are still a few rough edges to be smoothed out, and the list of plugins on the site is admittedly small so far. We’re requesting that plugin authors post their work to the new plugin repository in the next couple weeks, as we’ll be gradually phasing out the plugins wiki page.

    Special thanks to Mike Hostetler for the hours of work he put in to get the repository off to a great start.

    Check it out at: http://jquery.com/plugins/

    jQuery Paris Meetup

    Posted on by

    NOTE The venue for this event has changed! We’re now meeting at the Best Western Bergère Opéra, please change your plans accordingly.

    When:
    Sunday, June 24, 2007 – 10:30 AM

    Where:
    Best Western Bergère Opéra
    32, Rue Bergère
    Paris, ÃŽle-de-France 75009
    (Google Maps Directions)

    About:
    This is a meet up for those that use and are interested in the jQuery JavaScript Library. We’ll be meeting in the lobby of the Best Western Bergère Opéra and then move to a park for a picnic.

    John Resig, the creator and lead developer of jQuery, will be attending.

    This meet up is being organized by the SPIP (a popular CMS, happily using jQuery) core team.

    Register:
    If you’re interested in attending this event, please sign up on the event’s Upcoming.org page:
    http://upcoming.yahoo.com/event/206745

    New Command-Line jQuery Tool

    Posted on by

    Update: I have completely refactored jcheat and added substantial new functionality, including a ton of filters that can be used in any combination. Do a gem update and run jcheat -h for full usage details.

    I released a new tool, jquery-cheat, that allows you to get information about the jQuery API directly from the command-line. You can get the description of a function, a list of functions in each module, search the list of all function descriptions for a string, get a list of all functions whose name match a string, and some other cool tricks.

    Some examples:

    # jcheat desc clearForm
    --------------------------------------------------------------------------------
    Name:         clearForm()
    Description:  Clears the form data.
                  
    Details:      Clears the form data.  Takes the following actions on the
                  form's input fields:  - input text fields will have their
                  'value' property set to the empty string  - select elements
                  will have their 'selectedIndex' property set to -1  - checkbox
                  and radio inputs will have their 'checked' property set to
                  false  - inputs of type submit, button, reset, and hidden will
                  *not* be effected  - button elements will *not* be effected
                  
    Returns:      jQuery
    --------------------------------------------------------------------------------
    |                                   EXAMPLES                                   |
    --------------------------------------------------------------------------------
    ---------------
    | Description |
    ---------------
    Clears all forms on the page.
    
    --------
    | Code |
    --------
    $('form').clearForm();
    
    # jcheat namelike $.ajax
    $.ajaxTimeout(time) in Ajax
    $.ajaxSetup(settings) in Ajax
    $.ajax(properties) in Ajax
    
    # jcheat like clear field
    clearForm() in Plugins/Form
    clearFields() in Plugins/Form
    
    

    You can grab the tool by doing:

    gem install jquery-cheat -y
    

    The -y is so that it automatically includes hpricot, a required dependency.

    jQuery Dashboard Widget

    Posted on by

    jQuery Widget

    Ryan Dunphey has just released a brand new jQuery Dashboard Widget that you can use to browse the jQuery API, even when you’re not connected to the Internet. You can download the, sharply designed, widget from jQuery SVN.

    If you’re interested in doing some dashboard development (and especially widget development using jQuery), you can learn from this widget, as the full source code of it is in the jQuery SVN repository.

    This fantastic work (and the subsequent open source release of the widget) was sponsored by Ryan’s employer, Medallia. Incidentally, if you’re interested in getting paid to do some jQuery coding, Medallia has a Front-End Developer position open.

    Servers, servers, and donations

    Posted on by

    The jQuery services are mostly back to normal now, John has since moved the jQuery SVN to Google Code and is working to move the remaining mailing lists to Google Groups. So, the most important parts have weathered the recent server move, no problem.

    Of course, moving providers when a dedicated server is required usually brings with it a significant investment of capital. With that, we wanted to thank the jQuery community for springing to life and donating generously to help with the transition. In fact, the donations completely cover the initial cost of the new server.

    Obviously, we don’t really push for donations around here, so it’s great to see so many lend a helping hand. Thank you all.

    And now for some extra-good news!

    MT hearts jQuery

    Media Temple has stepped up to donate a great hosting package, to jQuery, complete with the industry-recognized support reputation preceding them. We anticipate being fully up-and-running on their hardware in the coming months, and welcome this new partnership and the benefits it will bring the jQuery community.

    Help Test jQuery 1.1.3

    Posted on by

    A test build of the upcoming 1.1.3 release is ready for everyone to try. We need to be super-sure that there haven’t been any regressions in this release, and in order to do that we’d like you to download this alpha release and try it in place of jQuery 1.1.2 (wherever you may be using it).

    Download the test release:


    Here’s what you can do to help:

    1. Download the test release of jQuery 1.1.3
    2. Temporarily replace your copy of jQuery 1.1.2 with this test release in some of your web pages
    3. If something is now broken, please submit a ticket letting us know what happened. The more specific you can be, the better (demos or test cases are highly desired).

    Note Pay special attention to Events, Selectors, and Animations; significant changes happened in all three of those areas, so if there’s any place where a regression is possible, it would be more likely to occur in there.

    Once we’re confident that there’s no new bugs, we’ll be releasing jQuery 1.1.3 fully (hopefully some time this week).

    jQuery Session at RailsConf

    Posted on by

    RailsConf 2007

    I’m happy to announce that my proposal for a Birds of a Feather session about “jQuery on Rails” at RailsConf has been accepted!

    If you’re at RailsConf, please come by room c125 on Thursday night at 9:30pm and join in the discussion. I’ll be chatting about my ongoing work on jQuery on Rails, and should have some code to demo if anyone would be interested.

    If you’re interested in hearing about how others have solved problems regarding the integration of jQuery with Rails, or just want to share something cool you’ve done, swing on by. See you there!

    More Details

    Yehuda has just posted more details on how jQuery on Rails works:

    Since I last publicly discussed jQuery on Rails, I’ve gone down a lot of avenues, and written a lot of code, and came to some conclusions:

    • jQuery and Unobtrusive JavaScript are fundamentally incompatible with an attempt to describe behavior inside markup, as Rails does via “JavaScript helpers.”
    • Attempts to fix the problem, specifically UJS for Rails, still require that you include your JS behaviors in your views, which are then marshalled into JavaScript files on the fly (and cached as appropriate). If you wanted to include the same JS behavior in multiple pages, you’d need to create custom helpers and call out to them.
    • jQuery is already the perfect mechanism for unobtrusive JavaScript, baked right into the library
    • The biggest problem faced by jQuery developers is not simplicity (which, again, you get for free in the library), but difficulty in including the correct jQuery “modules” in the Rails views that require them.

    The most common problem with using jQuery with Rails in an app of moderate or higher complexity is the trade-off between including everything in a single application.js (which can lead to serious slowdowns in larger apps) and having multiple, modular files (which are a serious pain to include correctly as needed).

    This is a problem for jQuery users who want to use Rails more than Rails users who are used to Prototype helpers and want to be able to use the jQuery library as a drop-in replacement. In the first release of jQuery on Rails, I will be targeting jQuery developers who want to work with Rails. In other words, jQuery on Rails is for you if you know jQuery or are willing to use jQuery.

    This release of jQuery is not for you if you don’t want to learn jQuery, and want to program purely in Ruby. There will be a future release that will include some features for pure-Ruby developers, but I maintain that Unobtrusive JavaScript is fundamentally incompatible with that mode of thinking.

    With all that said, what does jQuery on Rails actually do?

    First up, it’s a Rails plugin, which you activate by adding <%= include_jquery %> in your application.rhtml. When your server is started, it’ll parse all of your JavaScript files, and identify selectors in those files. When include_jquery is called in your layout, it’ll get the rendered HTML and use Hpricot (which shares syntax with jQuery) to determine whether any instances of the selectors identified on server startup are present.

    The JavaScript files that have selectors that are also present in your HTML will be loaded, and run as expected.

    So in short:

    • Create your JavaScript files, using selectors as usual
    • Use include_jquery in your layout
    • You’re done