jQuery: The Write Less, Do More JavaScript Library

Blog » jQuery 1.1a

Posted January 8th, 2007 by John Resig

As previously announced, today we’re bringing you the alpha release of jQuery 1.1. We’d really appreciate it if you could help us test this alpha, so that we can have a stand-up release this weekend - just in time for jQuery’s 1 Year Anniversary! (January 14th)

This is going to be a fantastic release. In fact, this release is so good that we’re going to be taking this entire week to tell you about what’s new and how you can best use it. The Evangelism team has a bunch of stuff lined up to get you introduced and ready to use this great new version of jQuery.

Here’s the quick-and-dirty on jQuery 1.1:

  • Its selectors are 10-20x faster than those in jQuery 1.0.4.
  • The documentation has been completely revamped.
  • The complexity of the API has dropped by 47%.
  • It has a ton of bug fixes.
  • It has a bunch of great new features.
  • … and it’s still the small 19KB that you’ve come to expect.

We’re going to have the full run down during the next couple days, but for right now, it’s shaping up to be a great release.

Download

API Changes

NOTE: We will release a backwards compatibility plugin together with the full release of jQuery 1.1, when it is released this weekend.

It’s important to note that there’s been a lot of API changes. Some in the form of additions, some in the form of reorganization. If you’d like to help us test this alpha release, please keep these changes in mind:

:nth-child() now starts at 1, instead of 0. Our implementation of the CSS 3 selector started its numbering at 0, instead of 1. This is a bug fix, but one that may effect your code.

// 1.0.x: Get the first column from a table
$("td:nth-child(0)")

// 1.1: Get the first column from a table
$("td:nth-child(1)")

The following methods have been renamed/reorganized in this version, here is how you can continue to use them, as you would expect:

Old Way (1.0.x) New Way (1.1)
.ancestors() .parents()
.width() .css(”width”)
.height() .css(”height”)
.top() .css(”top”)
.left() .css(”left”)
.position() .css(”position”)
.float() .css(”float”)
.overflow() .css(”overflow”)
.color() .css(”color”)
.background() .css(”background”)
.id() .attr(”id”)
.title() .attr(”title”)
.name() .attr(”name”)
.href() .attr(”href”)
.src() .attr(”src”)
.rel() .attr(”rel”)
.oneblur(fn) .one(”blur”,fn)
.onefocus(fn) .one(”focus”,fn)
.oneload(fn) .one(”load”,fn)
.oneresize(fn) .one(”resize”,fn)
.onescroll(fn) .one(”scroll”,fn)
.oneunload(fn) .one(”unload”,fn)
.oneclick(fn) .one(”click”,fn)
.onedblclick(fn) .one(”dblclick”,fn)
.onemousedown(fn) .one(”mousedown”,fn)
.onemouseup(fn) .one(”mouseup”,fn)
.onemousemove(fn) .one(”mousemove”,fn)
.onemouseover(fn) .one(”mouseover”,fn)
.onemouseout(fn) .one(”mouseout”,fn)
.onechange(fn) .one(”change”,fn)
.onereset(fn) .one(”reset”,fn)
.oneselect(fn) .one(”select”,fn)
.onesubmit(fn) .one(”submit”,fn)
.onekeydown(fn) .one(”keydown”,fn)
.onekeypress(fn) .one(”keypress”,fn)
.onekeyup(fn) .one(”keyup”,fn)
.oneerror(fn) .one(”error”,fn)
.unblur(fn) .unbind(”blur”,fn)
.unfocus(fn) .unbind(”focus”,fn)
.unload(fn) .unbind(”load”,fn)
.unresize(fn) .unbind(”resize”,fn)
.unscroll(fn) .unbind(”scroll”,fn)
.ununload(fn) .unbind(”unload”,fn)
.unclick(fn) .unbind(”click”,fn)
.undblclick(fn) .unbind(”dblclick”,fn)
.unmousedown(fn) .unbind(”mousedown”,fn)
.unmouseup(fn) .unbind(”mouseup”,fn)
.unmousemove(fn) .unbind(”mousemove”,fn)
.unmouseover(fn) .unbind(”mouseover”,fn)
.unmouseout(fn) .unbind(”mouseout”,fn)
.unchange(fn) .unbind(”change”,fn)
.unreset(fn) .unbind(”reset”,fn)
.unselect(fn) .unbind(”select”,fn)
.unsubmit(fn) .unbind(”submit”,fn)
.unkeydown(fn) .unbind(”keydown”,fn)
.unkeypress(fn) .unbind(”keypress”,fn)
.unkeyup(fn) .unbind(”keyup”,fn)
.unerror(fn) .unbind(”error”,fn)

I realize that’s a long list - but you’d be surprised how much of that no one was using. By removing all of those methods we’ve been able to reduce the size of the jQuery API by 47%. We’re going to have more information about the API changes in particular, but for now, this list should help you to sort out any major differences in your code.

If you have any questions, feel free to post them here in the comments and we’ll get them answered right away.


35 Responses to “jQuery 1.1a”

  1. Raymond Says:

    What kind of compression will be used for the final version ??
    Because there is a plugin for jquery to help with embedding Flash movies and it has problems with the compressed version of 1.04 ( http://jquery.lukelutman.com/plugins/flash/ )

  2. Aaron Heimlich Says:

    @Raymond - jQuery has been using Dean Edwards’ Packer (http://dean.edwards.name/packer/) for compression, and I don’t think that’s going change. If you want to use a different compression script, you can try Dojo ShrinkSafe (http://alex.dojotoolkit.org/shrinksafe/) or JSMin (http://www.crockford.com/javascript/jsmin.html), but I haven’t tested these with jQuery yet (JSMin should be fine, though, if Luke’s recommending it).

    John, in light of this, you might want to consider offering other compression options (unless we can solve whatever issue IE has with Dean’s Packer).

  3. Remy Says:

    It’s not perfect (i.e. always test afterwards) - but here’s a quick grep to check if you’re using any of these functions John listed:

    egrep ‘\.ancestors\(|\.width\(|\.height\(|\.top\(|\.left\(|\.position\(|\.float\(|\.overflow\(|\.color\(|\.background\(|\.id\(|\.title\(|\.name\(|\.href\(|\.src\(|\.rel\(|\.one.*+\(|\.un.*+\(’ *.js

  4. sorgalla.com - jQuery 1.1a and jCarousel 0.1.5 Says:

    […] The jQuery Team released the alpha version of the new jQuery 1.1. […]

  5. bassistance.de » jQuery 1.1a Release Says:

    […] jQuery 1.1a was released a few hours ago and is ready for public testing. […]

  6. jQuery 1.1 alpha - Scriptia Says:

    […] Hoy mismo se ha publicado la primera alpha de jQuery 1.1. El equipo de desarrollo solicita colaboración para la detección de bugs y da detalles de las novedades en jQuery 1.1a. Lo mejor: velocidad y simplificación de la API. […]

  7. Lançada a jQuery 1.1a « felipediesel.net Says:

    […] Mais informações no blog da jQuery. […]

  8. alex Says:

    $(’.select’).parents().addClass(’test’); does not work. how can i get the (old) ancestors with the new method?

  9. Vladimir Says:

    John, why not go further and remove all event shortcuts like click() and use bind instead?

  10. BorkWeb » jQuery 1.1a Released Says:

    […] The jQuery 1.1a has been released today by the jQuery team! Its important to note that this is an alpha version before you go out and install it in a production environment, but the jQuery team asks that people give it a round of testing prior to the release this weekend. […]

  11. John Resig Says:

    @Raymond: If you’re having trouble with the current compressed version of jQuery, then that’s definitely a bug. It would help if you could submit a bug report so that we could track it down further.

    @alex: .ancestors() and .parents() were (are) the same thing. .ancestors() was just an alias for .parents(). If you’re having trouble with .parents(), then you should probably submit a bug report on that, as that sounds like something new.

    @Vladimir: We found that people used the .event() shortcuts way too frequently in order to justify removing them. We had to balance the “cost” of keeping a shortcut in against how frequently it was used; all the other methods didn’t make the cut ;-)

  12. danielyuen.hk Blog : links for 2007-01-08 Says:

    […] jQuery: Blog: » jQuery 1.1a (tags: javascript ajax css) […]

  13. Marcel Popescu Says:

    Are you sure it’s “one” and not “on”? As in .on(”click”, fn)? It would make more sense…

  14. Karl Swedberg Says:

    @Marcel, Nope, it’s “one.” jQuery uses .bind() for generic event binding. The .one() method unbinds it after it’s triggered once.

  15. Aaron Heimlich Says:

    @John - From what I understand, it’s specifically related to IE’s ActiveX Control Activation(1,2). You’ll probably need to ask Luke for more info(3).

    (1) http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp
    (2) I don’t know who to hate more, Eolas for bringing up the whole issue, or Microsoft for giving in to them.
    (3) http://jquery.lukelutman.com/plugins/flash/#activex

  16. MathieuMa Says:

    Just upgraded a site I am amking for testing using a compressed 1.1a - I have a crash in Safari whenever I display any page - the following code causes this - only when there is an external link on the page :
    $(”a[@href^=http://]”).not(”[@href*=’xxx.yyy.com/’]”).each(function() {

    Although it’s a safari issue - it’s still good to know.

  17. MathieuMa Says:

    Filled a bug report for this, the issue is caused by what happends next, which works on each passed object :
    $(this).html( $(this).html() + ” ” );

  18. Jason Says:

    Will there be any more alpha releases before the actual release?

  19. Fil Says:

    I know it’s easy, but here’s a grep expression that matches the abadoned syntax.

    [.](ancestors|width|height|top|left|position|float|overflow|color|background|id|title|name|href|src|rel|oneblur|(one|un)(focus|load|resize|scroll|unload|click|dblclick|mousedown|mouseup|mousemove|mouseover|mouseout|change|reset|select|submit|keydown|keypress|keyup|error))\s*[(]|:nth-child

    use it e.g. as in:

    grep -E “this-expression” `find . -name ‘*.js’`

  20. Websites and stuff (need to think of a real name, I know) » Jquery 1.1alfa Says:

    […] Kondigde ik in m’n vorige post nog aan dat er een nieuwe versie van jQuery aan zat te komen, nu is de alfa versie uit: http://jquery.com/blog/2007/01/08/jquery-11a/  […]

  21. d405 Says:

    I just stepped thru the code on the demo page that shows/hides a div using jquery. Oh my god ! I had to go through hundreds of lines of code to hide a div. And what code it was, euuuw. If this is the way Javascript is going then I think I’m getting out. The JSON style of coding is bad enough, but the way it’s been used in jQuery is an abomination. The syntax of what people have to write in order to use jQuery is also totally alien to anything that looks like a scripting language. I’m really glad I don’t have to use this stuff. Use GWT people! It’s the way forward, not this.

  22. John Resig Says:

    @d405: I honestly have no idea what you’re talking about, so I’ll just say this:

    $("div").hide();
  23. » jQuery 1.1a Подробно Says:

    […] Вышла предварилка jQuery. О чём сообщается в блоге. […]

  24. Stephen Clay Says:

    What sped up selection so much? Start compiling CSS queries to XPath?

  25. John Resig Says:

    @Stephen: We just rewrote large parts of it, highly optimizing for common situations (like “div .class”, “#foo #bar”, and “div#foo”). Unfortunately, compiling to XPath still isn’t a cross browser solution (Internet Explorer doesn’t have XPath support for HTML documents).

  26. adam, Blog o Internecie Says:

    @d405

    please refrain from such childish black PR
    please try jQuery before judging it… i found it the most intuitive JSframework one could create… “javascript for masses” :)

    Greeting from polish funclub :)

  27. Nate Cavanaugh Says:

    Clue 1 that d405 is a moron:
    “The JSON style of coding is bad enough, but the way it’s been used in jQuery is an abomination.”

    Uh, yeah, the JSON style is bad? Sorry to disappoint you, but that’s down to the core of Javascript.
    EVERYTHING is an object. Even functions (but then again, I don’t really expect you to know that).

    Everything is written in object notation.
    If you don’t know that, then perhaps you should visit http://www.lissaexplains.com/ . It might be more your speed…

  28. alex Says:

    @d405: try this:

    $(”d405″).hide().remove();

  29. Jed Says:

    This is awesome.
    Can’t remember who’s quote this is.. but it goes along the lines of
    “A design is only perfect when there is no longer anything that can be removed”

    I applaud you for these changes and making jquery even better and smaller!

    -Jed

  30. jQuery: Blog: » jQuery 1.1b Says:

    […] So, while its fully possible to continue using the compatibility plugin into the foreseeable future, it is highly recommended that you follow the upgrade plans mentioned before. […]

  31. SoftExpert Says:

    There seems to be an error with the packed version of 1.1b (I used http://dean.edwards.name/packer/ with default options) throws “missing ; before statement” !
    Don’t know how to debug it :-(
    Unpacked version is awesome !!! :-)

  32. bassistance.de » jQuery 1.1b Release Says:

    […] Today jQuery 1.1b was released. It fixes all the bugs that were found in 1.1a and to prepare for the 1.1 final release. If you find any bugs, and please consider everything that doesn’t work after upgrading a bug, report them. […]

  33. jQuery: » jQuery Birthday: 1.1, New Site, New Docs Says:

    […] This is a great release - tons of bug fixes, huge speed improvements, and a big simplification of the outstanding API. It is highly recommend that you upgrade to get all the benefits of this release. […]

  34. Learning jQuery » jQuery 1.1 Released! Says:

    […] Are you still here? Oh well. Then bear with me another minute while I write a bit more about the streamlined API. The new jQuery has much more speed and functionality for just a couple more kb of code. One way that was achieved was by stripping out some of the excess helper methods that appeared to be little used or redundant. If you are running jQuery on a production site, please be careful about upgrading. A good way to start is to drop in the jQuery 1.0 to 1.1 compatibility plugin (JS file), and then read through the list of API changes that John Resig outlined in a recent blog entry. […]

  35. jQuery 1.1 - Jowra | Webdesign - Photo - Artwork Says:

    […] Weiterhin gab es goße Vereinfachungen in der jQuery-API, die bereits vor einigen Tagen näher erläutert wurden. Bei einem Update sollte man beachten, daß sich einige API-Aufrufe geändert haben. Weiterhin wurde die Dokumentation stark überarbeitet und ausgebaut. An dieser Stelle sei auch auf Visual jQuery verwiesen, die etwas andere Art die API zu erkunden. Auch diese Fassung wurde bereits auf Version 1.1 aktualisiert. […]