jQuery 1.1a

Posted on by

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.


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

// 1.1: Get the first column from a table

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.

33 thoughts on “jQuery 1.1a

  1. @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).

  2. 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

  3. Pingback: sorgalla.com - jQuery 1.1a and jCarousel 0.1.5

  4. Pingback: bassistance.de » jQuery 1.1a Release

  5. Pingback: jQuery 1.1 alpha - Scriptia

  6. Pingback: Lançada a jQuery 1.1a « felipediesel.net

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

  8. Vladimir on said:

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

  9. Pingback: BorkWeb » jQuery 1.1a Released

  10. @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 ;-)

  11. Pingback: danielyuen.hk Blog : links for 2007-01-08

  12. Marcel Popescu on said:

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

  13. 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.

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

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


    use it e.g. as in:

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

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

  17. 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.

  18. @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).

  19. @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 :)

  20. 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…

  21. 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!


  22. Pingback: jQuery: Blog: » jQuery 1.1b

  23. Pingback: bassistance.de » jQuery 1.1b Release

  24. Pingback: jQuery: » jQuery Birthday: 1.1, New Site, New Docs

  25. Pingback: Learning jQuery » jQuery 1.1 Released!