SXSWi jQuery Meetup

Posted on by

Right now the annual SXSWi conference is happening in beautiful, sunny, Austin, Texas. Interestingly enough, there’s a ton of jQuery users here (as am I). I’ve already had the opportunity to talk with a number of you, but we should really do a proper get together.

As proposed by Luke Lutman, on the mailing list, and Cody Lindley (of Thickbox fame) – let’s do a meetup! Let’s say Monday (Mar 12th) at lunch. Meet at the main doors facing the Courtyard Hotel. If you have any troubles, feel free to give me a call at 585-615-5287 and I’ll direct you in.

I’m looking forward to meeting everyone!

See Also: http://upcoming.org/event/162778/

Update: Just to clarify, this is at 12:30pm (after the 11:30am-12:30pm session ends). And the doors are at the corner of Trinity and and Fourth St. I’ll be wearing a bright red Atari T-Shirt, so I should be easy to spot.

jQuery 1.1.2

Posted on by

Translations: Italiano, français

The release of jQuery 1.1.2 is upon us! This is a another bug fix release. We’ve fixed a number of outstanding issues. The fixes have been tested well, so there shouldn’t be any regressions (knock on wood). The most noticeable issue that was resolved was related to animation flickers when doing a slideDown.

It is highly recommended that you upgrade.

As always, if you have any questions or concerns with new release, please feel free to discuss it on the jQuery Mailing List. If you think you’ve spotted a bug, please add it to the bug tracker.

Download

Bug Fixes

The most important bug fixes, relevant to this release, are as follows:

  1. Change: Event handlers (like element.onclick) are now removed when no more functions are bound to the event.
  2. Fixed: DOM Manipulations for form elements.
  3. Fixed: jQuery.isFunction to return false on nodes.
  4. Fixed: jQuery.className.has, escaping regex characters in className (for metadata)
  5. Fixed: an issue in IE where an event on a cloned element is fired during a .clone() inside of an event handler.
  6. Fixed: IE ID selectors selecting by the name attribute.
  7. Changed: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos).
  8. Changed: .attr('href') is now consistent in all browsers.
  9. Changed: @href is now consistent in all browsers.
  10. Fixed: the slideDown flickering bug.
  11. Fixed: Having a \r endline in $("...") caused a never-ending loop.
  12. Fixed: IE6 AJAX memory leak
  13. Fixed: bug in pushStack, reporting an element at [0] in a jQuery object with length 0

Documentation

Additionally, the documentation has been back-ported out of the wiki and into the API docs. All of the documentation resources have been updated in respect to the 1.1.2 release.

Leading up to jQuery 1.1.3…

This may seem like a fairly light bug fix release, but we’re gearing up to the release of jQuery 1.1.3. A number of outstanding bugs (about 5-10) require significant changes to how jQuery works, internally (specifically, in relation to events and animations). We want to make 100% certain that there are no regressions made to these important pieces of code.

We have patches nearly ready (animation is ready, events is in the works) – and when that’s the case, we’re going to release a preview of the 1.1.3 code so that everyone can test against it.

Update: This has also been announced on Learning jQuery: jQuery 1.1.2 Released

Update: A nasty glitch in Safari was found and fixed. We just re-tagged jQuery (it’s now SVN rev 1465 instead of 1460 – this includes a fix for the bug, and it temporarily disables the test suite in Safari) and all the jQuery 1.1.2 downloads should be updated, as well.

jQuery is OpenAjax Compliant

Posted on by

OpenAjax Alliance

A new initiative has been forming, over the recent months, in an attempt to standardize the different Ajax and JavaScript codebases that exist. A number of corporate entities have come together to draft the new OpenAjax standard (including IBM, Adobe, Opera, and Mozilla).

Today we’re announcing a new plugin that you can use to make jQuery OpenAjax compliant. By doing this, jQuery is becoming one of the first projects that has made its codebase compliant with the new standard.

Currently, the requirements for compliance are, relatively, simple – but still quite important. The relevant rules can be summarized as such:

  • All libraries must register themselves (their name, version, and namespace) with the main OpenAjax library.
  • All libraries must register any global variables that they use (in the case of jQuery it’s ‘jQuery’, and optionally ‘$’ – it defaults to just including ‘jQuery’).
  • Any attempt to register “onload” or “onunload” handlers must go through the OpenAjax library. In the case of jQuery, if you do: $(window).load(function), and OpenAjax is included, jQuery will defer to OpenAjax’s solution.
  • Libraries must not disrupt the ability of other libraries to traverse the HTML DOM document.

You can view jQuery’s compliance results, to verify that it does, indeed, past the test suite.

If you wish to use jQuery in conjunction with other OpenAjax-capable libraries, the process is rather straight forward.

Step 1 Download a copy of the jQuery OpenAjax plugin to your server.

Step 2 Include the library in your site, just after you include jQuery.

<script src="jquery.js"></script>
<script src="jquery.openajax.js"></script>

Be sure to include both jQuery and the jQuery OpenAjax plugin after you’ve included the official OpenAjax library itself.

And that’s it! jQuery will now happily play with the OpenAjax core library.

It should be noted that, currently, jQuery is not part of the OpenAjax Alliance, but we’re in the process of applying and are eager to begin actively participating.

jQuery and Jack Slocum’s Ext

Posted on by

Ext JavaScript Library

Today, we’re proud to announce that the jQuery Project and Jack Slocum’s Ext Project, have partnered to integrate the amazingly lightweight and powerful jQuery framework with Ext’s awesome UI library. This collaboration will greatly enhance the capabilities of both projects and expand the functionality available to developers using the jQuery JavaScript Library and the Ext UI component suite.

Specifically, the upcoming Ext 1.0 release will be able to run, natively, on the jQuery JavaScript Library. No other libraries will be required. The jQuery and Ext teams are actively working together to bring this integration to the Ext codebase.

Here’s some possible questions and answers (feel free to post any others that you have in the comments):

What prompted the collaboration?

Ext has some fantastic components – arguably, the best on the web. jQuery has all the core functionality to support what Ext has. The jQuery team contacted Jack Slocum with the hopes that we could work together to add jQuery support to the Ext library, and Jack whole-heartedly agreed. It’s a win-win situation: jQuery gets some awesome components, Ext gets a huge influx of new users.

What are the benefits for jQuery and Ext users?

jQuery users gain a huge number of expertly-designed components that they will be able to deploy immediately. Additionally, they’ll be able to use them in a manner that better suits the jQuery philosophy (e.g. being able to call Ext queries on sets of elements, chaining calls, leveraging jQuery’s support for true unobtrusive DOM scripting etc.)

At the same time, existing Ext users will gain the flexibility of being able to continue to use Ext’s professional-caliber components while leveraging the lightweight, small (~19k) and powerful jQuery framework.

How will the two teams work together?

After the first beta release of Ext 1.0, jQuery will be providing a
strike team which will work to iron out all the integration points in Ext. At the same time, Jack will be working to isolate all the remaining framework-specific code, making it easier for us to finish the conversion process. All of this will be in place for Ext’s final 1.0 release, which will support both Yahoo UI and jQuery.

How will support be handled?

The jQuery team will be providing support for any bugs that may only exist in the jQuery version of Ext.

Support for Ext, itself, will continue to be handled via the Ext forums. The Ext project will also begin offering a level of paid support for its corporate users.

What Ext features will be included in Ext 1.0 for jQuery

All available Ext 1.0 features are going to be supported by jQuery.

The final feature list, for Ext 1.0, is still being finalized but a full breadth of new functionality can be expected.

When will Ext 1.0 for jQuery be available?

The final release date still has yet to be finalized and we will make a formal announcement on the jQuery blog, the jQuery mailing list, the Ext project site, and the Ext forums once the its ready to go.

An alpha release of Ext 1.0 was just released, but does not, yet, include the jQuery compatibility layer.

Do any licensing issues exist?

No. jQuery’s licensing will remain the same, and Ext 1.0 will be completely open source (LGPL).

Additionally, corporations will be able to purchase an Ext support license. This will include email support and SVN access, amongst other features.

Update: Digg this story up!

Examples

Here are examples of what you can do with Ext. (All demos currently run on Yahoo UI, as the Ext 1.0 alpha release doesn’t support jQuery.)

Paged, Dynamic, Grids

Ext Paged Grid

Mixed Content Menus

Ext Mixed Content Menus

Advanced Dialog Layout and Themes

Ext Dialog Layout

Message Box Dialog

Ext Message Box Dialog

Drag-and-Drop Trees

Ext Drag and Drop Trees

jQuery 1.1.1

Posted on by

The bug fix release for 1.1 is now ready for all to use. There were a lot of weird behaviors that were discovered post-1.1 that needed to be remedied sooner, rather than later. If you were having any difficulties with the 1.1 release, please try this new release to see if your problems were solved.

It is highly recommended that you upgrade.

As always, if you have any questions or concerns with new release, please feel free to discuss it on the jQuery Mailing List. If you think you’ve spotted a bug, please add it to the bug tracker.

Download

Every bug ever fixed with jQuery can be found on the main bug fixes list. The most important bug fixes, relevant to this release, are as follows:

  1. Setting the numerical value of a css property failed, for example: .css(“opacity”,0.5) (also occurred with zIndex, fontWeight)
  2. Calling $(…, jqobj) with a context of a jQuery object failed.
  3. Accessing a property on an element that doesn’t exist caused an error, for example: $(“#foobar”).attr(“id”)
  4. Calling .load() without a callback caused an error.
  5. You couldn’t cancel an event that was triggered using .trigger() or .click() (for example).
  6. .add()ing a single DOM element to a jQuery object was broken.
  7. Passing in undefined values to a $.post() caused weird errors to occur.
  8. Accessing child nodes within an example document didn’t work properly.
  9. jQuery.isFunction() was unable to reliably determine a function, in a cross-browser way.
  10. Triggering a .click() failed in IE.
  11. Triggered click handlers were executed twice in most browsers.
  12. A newline passed into $(“…”) caused Firefox to go into a never-ending loop.
  13. Calling $.post() without any data caused an error.
  14. Calling a descendant selector after a child selector caused strange results, for example: $(“ul > li ul”)
  15. Triggered events did not occur if an event handler was not bound for that event.

Interface 1.1 Released

Posted on by

The ever-popular, jQuery-based, Drag-and-Drop, Animation, and Widget library, Interface has just released version 1.1 to coincide with the release of jQuery 1.1.

Interface Color Picker

A couple things to note about this release:

  • The brand new animateClass, animateStyle, and animateColor handlers. You can now do an animation from one particular class, to another – and from one color, to another.
  • The speed of droppables and sortables has been vastly improved.
  • The documentation has been overhauled and is quite comprehensive now.
  • The download area has been reworked, and is completely interactive.
  • There’s a ton of demos to see. They’ve updated a bunch of the existing ones and added in some hot new ones, like: Color Picker, Image Cropper, Panorama View, and a Folder tree.

All-in-all, this is a fantastic release. If you haven’t taken the opportunity to check out Interface yet, I recommend that you do now.

jQuery Birthday: 1.1, New Site, New Docs

Posted on by

Great news, everyone! Today is jQuery’s 1 Year “Birthday”! (I released it 1 year ago, today, at BarCamp New York City) In celebration, we’ve got a bunch of stuff for you to enjoy.

1) jQuery 1.1

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.

Download Now:

Upgrade Guide:

Please read through these guides before upgrading from 1.0.4 to 1.1 – a number of API changes have been made, and these guides detail how to work through them, and how to use the new jQuery 1.0 Compatibility Plugin to keep 1.0-style functionality in 1.1.

New Features:

  • By all of our counts, jQuery 1.1′s selectors are 10x-20x faster than those in jQuery 1.0.4. This should provide a noticable difference in your jQuery applications.
  • Common selectors like div#id, div .class, td:nth-child(1), and div > div are all significantly faster. It’s a complete world of difference. Try them out and you’ll see.
  • You can now pass in a function as a value for an attribute or a css property. The function is executed and its return value is set as the value for the property. For example:
    // 1.0 Code
    $("a").each(function(){
        $(this).attr("href", "/item/" + this.id);
    }).show();
    
    // 1.1 Code
    $("a").attr("href", function(){ return "/item/" + this.id; }).show();
  • You can now unbind an event handler from within itself. This allows you to have event handlers that are only bound for a specific number of executions, for example:
    $("button").click(function(e){
        // Unbind the event handler if a specific form is hidden
        if ( $("#submitForm").is(":hidden") ) {
            $(this).unbind( e );
        }
    });
  • Easily bind an event that will only occur once (this replaces the old .oneclick() functionality):
    // Show a thank you message for a form submission, but only once
    $("form").one("submit",function(){
        $("#thankyou").show();
    });
  • You can now set the text value of an element (this is different from .html(), where in .text() all HTML is displayed as text).
    $("pre").text("<b>Hello</b>, how are you?");
    
    // Result:
    <pre>&lt;b&gt;Hello&lt;/b&gt;, how are you?</pre>
  • You can now build your own filters, using a custom function. (This was in 1.0, but it wasn’t documented very well.)
    // Find all divs whose parent isn't hidden
    $("div").filter(function(){
      return $(this).parent(":hidden").length > 0;
    });
  • You can now pass a comma-separated list of selectors to the following filter functions:
    filter, find, not, siblings, parents, children, next, prev. This allows you to do some very cool stuff:

    // Find all radio buttons, or checkboxes, in a form
    $("form input").filter(":radio, :checkbox");
    
    // Find the next element that's a span, or a div
    $(this).next("span, div");

2) Refreshed Web Site Design

jQuery Site Screenshot
The design of the jQuery web site has finally be given a much-needed facelift. This was planned out by the fantastic jQuery Design Team and implemented by Nate Cavanaugh. The design team has a full redesign/restructuring planned, but we wanted something that would help us get from our current design to the complete overhaul. Hope you enjoy it – and be sure to thank Nate, Bradley, or Skye for their job well done!

3) Overhauled Documentation

A big point that we’ve been working with, lately, was to really pull together and categorize the jQuery Documentation, Tutorials, and API into one centralized location. The result of this effort is the new:
http://docs.jquery.com/
All jQuery documentation can be found in this one, central, location – making it easier for you to find what you need and get your work done faster. We hope you enjoy this new structuring, please let us know if you have any suggestions for what we can add to make it better.

4) A Secret…

We’ve been holding this one back a while, but we’re finally ready to let it go… There’s a jQuery Book in the works! An excited publisher has stepped up, and the authors are already a quarter of the way complete. There’s still some details in the works, and we’re going to tell all once its getting nearer to completion, but right now it’s looking like we’re going to have a late-Spring/early-Summer release of the first jQuery book!

Blank Book

I hope you enjoy everything – a lot of time and effort has really gone into making this release great. Be sure to thank everyone on the jQuery Team, they’ve put a lot of time and effort into making this release come out really good.

I’ll be doing a “State of the Query” post tomorrow, to talk about where jQuery has come during this past year, and the evangelism team will be doing a couple blog posts about what you can do with the new jQuery 1.1.

Thank you, everyone, for making this a fantastic first year for jQuery.

Selector Speeds

Posted on by

Note: Jack went ahead and fixed virtually everything mentioned in this post – great job!


We’ve been holding off on talking about the speed of the jQuery selectors for the new 1.1 release until our release was closer to being ready – however, it seems as if that process has already been expedited. So with that already out of the bag, lets look at the selector speeds of jQuery.

In short: For jQuery 1.1 we worked really really hard to make its selectors really fast. In fact, according to all our tests we were faster than any other selector library. Working on the 1.1 release, Dean Edwards’ cssQuery far out-performed any other selector library. It’s really comprehensive, and really fast.

Today, Jack Slocum announced his new DOMQuery selector library. In short: The bar has been raised. His library is very very fast. Quite possibly the fastest available today.

However, in the comparison between his library and ours, some mistakes were made that we’d like to clear up. (By both Jack and jQuery) (For reference, here’s the comparision suite that I used for my tests.)

jQuery completely supports all attribute selectors.
For example, [@foo], [@foo=bar], etc. The notable difference is that jQuery uses the XPath-style syntax in this situation. Since this was not accounted for in Jack’s test, it appeared as if we failed for all of the attribute selector tests.

Our “elem:empty” works just fine.
You can see in Jack’s test that all selectors (but DOMQuery) fail :empty – that’s more due to the fact that he compares the results against DOMQuery, which gets the result wrong. The specification states that something is empty if it doesn’t contain any child elements or text nodes. That doesn’t seem to be accounted for in this case.

[foo!=bar], :first, :last aren’t part of any specification.
…and yet they’re in the test suite. Incidentally, jQuery does implement :first and :last – but not [foo!=bar] (which appears to be only in cssQuery?). In all, its very strange to compare yourself against others when its not something that you’re designed to do.

What does span:not(span.hl-code) match?
This is a strange gray area that I haven’t seen talked about anywhere, and the specification doesn’t help to clear it up at all. Should the resulting set be all spans that don’t have a class of hl-code – or nothing, since you’ve filtered out all the spans. For example:

// Finds nothing in both
span:not(span)
=> []

// Finds spans that don't have a class of 'foo', in both
span:not(.foo)
=> [ <span>, <span>, ... ]

// jQuery's interpretation of the combination:
$("span:not(span.foo)")
=> []

// DOMQuery's interpretation of the combination:
Ext.select("span:not(span.foo")
=> [ <span>, <span>, ... ]

We’ll fully concede that we may be very wrong on this point – but I’m curious to hear what others have to say, and what they’re interpretations of the spec, are.

DOMQuery doesn’t account for duplicates.
Currently, doing Ext.select(“div div”) returns MORE elements than doing just Ext.select(“div”) – and doing Ext.select(“div div div”) returns yet another different set of elements, but still more than just doing Ext.select(“div”). In fact, accounting for duplicates is a huge problem in JavaScript selector libraries – and currently, jQuery is the only one that gets it right.

A big point of this is that accounting for duplicates can be really expensive (computationally) – so the fact that DOMQuery doesn’t account for duplicates gives the appearance of a speed boost. For example:

// DOMQuery
Ext.select("div").elements.length
=> 246
Ext.select("div div").elements.length
=> 624
Ext.select("div div div").elements.length
=> 523

// jQuery
jQuery("div").length
=> 246
jQuery("div div").length
=> 243
jQuery("div div div").length
=> 239

DOMQuery doesn’t support multiple filters: elem.foo[foo=bar] or elem.foo.bar
Until this is implemented, a comparison with any other library simply isn’t fair. Building a library that’s fully capable of handling aspects like that (see: cssQuery, jQuery) comes at a great cost. (Whether it be in code size or speed cost.)

DOMQuery’s #id selectors don’t check for context
You’ll notice if you try to do a query like:

Ext.select("div #badid").elements
=> [div#badid]

That you’ll get an element by “badid” — even if that element isn’t actually inside of a div. Since no check for validity is actually made in the DOMQuery code, it’s blazing fast – and very wrong.

I should mention that until 1.1, jQuery was wrong on this point too, so its an easy issue to overlook.

Where’d the root element go?
You’ll find that searches for “html” and “*” in DOMQuery are strangely missing one obvious thing: The HTML element. seems kind of weird to exclude the root DOM element from all queries; especially since this is perfectly valid: “html > body *”.

…and to make it fair – here’s one for us :-)

Our :nth-child(even/odd) is flawed.
Currently it seems to only select one element (!?). I made a ticket for this and it should be resolved for this Sunday’s 1.1 release.

In all, its great to see the speed leaps that’ve been made by DOMQuery. Selector speed is one area where competition is truly warranted; every time a new speed increase is made, everyone wins (users, developers – everyone).

In fact, looking over his code, I already have some more ideas on how to increase the speed of jQuery!

So, to Jack: Thanks for helping to keep us on our toes – we’re looking forward to seeing your library improve, and everyone win.

jQuery 1.1b

Posted on by

We’re nearly ready for the big 1.1 release, this Sunday – but to hold you over, here’s another set of bug fixes to test upon. The jQuery dev team has been working long-and-hard to fix all the support requests that’ve been coming in this week, and we’ve been pretty successful in fixing just about everything that’s come across our plate.

We’d really appreciate it if you’d take the time to test the new 1.1b with your code, and if you spot any bugs, to please submit them to the bug tracker.

It’s not all bug fixes, however; we do have something new for you to try: The jQuery 1.0 Compatibility Plugin. As promised, this plugin provides all of the methods and selectors that were present in the last 1.0.4 release. So, theoretically, you should be able to drop in jQuery 1.1, and the new compatibility plugin and everything should work seamlessly.

This is how you would use the compatibility plugin with jQuery 1.1:

<html>
<head>
  <script src="jquery-1.1.js"></script>
  <script src="jquery.compat-1.0.js"></script>
  <script>
    $(document).ready(function(){
        // Your old 1.0-centric code
    });
  </script>
</head>
<body></body>
</html>

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.

So, again; please help us test this beta release! The more you help test, the better the final 1.1 release is going to be. Thanks for all your help!

Download

Update: There’s a couple things that I forgot to mention (that’s what I get for posting a release at 4am in the morning):

  • .filter([".foo", ".bar"]) is now .filter(“.foo, .bar”): A much simpler solution – and a fix is already in the compatibility plugin.
  • .We decided to keep .height() and .width(). They’re back in, as they’re quite useful.
  • The documentation is updated to 1.1b (so for those of you who still saw .filter([...]) or didn’t see .height() and .width() – it’s fixed now.)