Microsoft’s Proposal for Data Linking in jQuery. Feedback Requested.

Posted on by

Microsoft has submitted it’s second proposal to the jQuery Project outlining a plugin that allows properties within objects to be linked to each other. Termed “data linking”, the new plugin would allow changes made to a property of one object to effect a change on the property of a secondary object. The plugin leverages jQuery’s “special events” API to create a new event that will trigger when a change occurs on a bound object property. This would allow a developer to link properties in the following way:

var person = {};

$(“#name”).linkTo(“val”, person, “name”);

$(“#name”).val(“foo”);

alert(person.name); // foo

// … user changes value …
alert(person.name); // user typed value

The proposal has been submitted via the jQuery forums and Microsoft is actively soliciting community feedback:

http://forum.jquery.com/topic/proposal-for-adding-data-linking-to-jquery

A prototype of the data linking is available for review via Github:

http://github.com/nje/jquery-datalink

We’re pleased to see Microsoft’s continued contribution to our open source community and ask that you provide feedback in guiding this effort along.

Microsoft to Expand its Collaboration with the jQuery Community

Posted on by

The jQuery Project is excited to announce that Microsoft is expanding its support of the jQuery JavaScript Library through new initiatives, to include code contributions, product integration, and the allocation of additional resources.

Building on two years of collaboration with the jQuery Project, Microsoft announced today at MIX 2010 that it will be working with the jQuery Core Team and community to provide source code that will help to further advance the jQuery JavaScript Library. The planned contributions target specific functionalities in areas of mutual interest. They include:

  • Templating
  • Script Loading
  • Data Binding

The initial focus will be on a new templating engine that will allow for easy and flexible data rendering via defined templates. Microsoft has submitted a proposal for public review along with an experimental plugin, and is actively collaborating with the jQuery team and community on a unified implementation. The templating engine will be reviewed and considered for inclusion into the jQuery JavaScript Library or maintained as an official jQuery plugin.

Microsoft will also ship a current release of the jQuery JavaScript Library in both Visual Studio 2010 and ASP.NET MVC as well as continue to host current versions of the library on the Microsoft CDN.

Lastly, Microsoft will be providing resources to assist in QA testing of jQuery in new environments to ensure continued stability and longevity of the library.

We see these contributions as a tremendous benefit to the jQuery effort and community and look forward to continued collaboration with Microsoft.

jQuery Conference 2010: San Francisco Bay Area Announced

Posted on by

Microsoft Silicon Valley Research CenterThe jQuery Project is very excited to announce the dates for our first-ever San Francisco Bay Area conference. The conference will be held at the Microsoft Silicon Valley Research Center in Mountain View, California on April 24th and 25th, 2010.

The San Francisco Bay Area conference is the second of four events planned by the jQuery Project in 2010. The first was the jQuery14 event, and additional conferences are being planned in Europe and on the East Coast for later this year.

This venue is the largest that the project has worked with to date (Harvard Law School in ‘07, the MIT Stata Center in ‘08 and Microsoft New England Research Center in ’09) and we expect to sell out very quickly.

Registration is currently scheduled to open on Wednesday, March 17th; tickets will be priced at $199. In addition to General Admission tickets, we’re offering a limited number of discounted student tickets priced at $99, with a valid student ID.

Watch the jQuery blog or jQuery Twitter feed for notification when registration opens.

A brief synopsis of some of the content that you’ll be able to expect:

  • jQuery
  • jQuery UI
  • jQuery Plugins
  • Complex Application Development
  • jQuery Case Studies

In addition to two days of jQuery sessions, for the first time we’ll be adding an additional day of jQuery training, prior to the main event. The training will be provided by appendTo and focused on helping you and your team get up to speed on jQuery prior to attending the conference. The training will cover the following topics:

  • Introduction to jQuery
  • Finding Something
  • Doing Something With It
  • Chaining
  • Introduction to jQuery UI
  • Implementing jQuery UI Widgets

The training will be held on April 23rd at the Microsoft San Francisco offices in downtown San Francisco; tickets will cost $299. All proceeds from training go to the jQuery Project.

Interested in speaking? Please fill out our call for speaking submissions form and watch the jQuery Blog for updates.

jQuery 1.4.2 Released

Posted on by

jQuery 1.4.2 is now out! This is the second minor release on top of jQuery 1.4, fixing some outstanding bugs from the 1.4 release and landing some nice improvements.

I would like to thank the following people that provided patches for this release: Ben Alman, Justin Meyer, Neeraj Singh, and Noah Sloan.

Downloading

As usual, we provide two copies of jQuery, one minified (we now use the Google Closure Compiler as the default minifier) and one uncompressed (for debugging or reading).

You can feel free to include the above URLs directly into your site and you will get the full performance benefits of a quickly-loading jQuery.

Additionally you can also load the URLs directly from either Google or Microsoft’s CDNs:

New Features

A full list of the API changes can be found in the 1.4.2 category on the jQuery API site.

In this release we’ve added two new methods: .delegate() and .undelegate(). These methods serve as complements to the existing .live() and .die() methods in jQuery. They simplify the process of watching for specific events from a certain root within the document.

For example:

$("table").delegate("td", "hover", function(){
	$(this).toggleClass("hover");
});

This is equivalent to the following code written using .live():

$("table").each(function(){
	$("td", this).live("hover", function(){
		$(this).toggleClass("hover");
	});
});

Additionally, .live() is roughly equivalent to the following .delegate() code.

$(document).delegate("td", "hover", function(){
	$(this).toggleClass("hover");
});

What’s Changed?

There has been some large code rewrites within this release, both for performance and for fixing long-standing issues.

Performance Improvements

As is the case with virtually every release of jQuery: We’ve worked hard to continue to improve the performance of the code base, making sure that you’re provided with the best performing JavaScript code possible.

According to the numbers presented by the Taskspeed benchmark we’ve improved the performance of jQuery about 2x compared to jQuery 1.4.1 and about 3x compared to jQuery 1.3.2.

jQuery Taskspeed Results (Feb 14, 2010)

Specifically we’ve improved the performance of 4 areas within jQuery:

While comprehensive benchmarks like Taskspeed can be interesting if deconstructed into individual sub-tests for further study, as a project we tend to stay away from using them as an accurate measure of true, overall, library performance. Considering how many aspects make up a library, not to mention the different techniques that they offer, cumulative results rarely reflect how an actual user may use a library.

For example, we saw significant overall performance speed-ups in Taskspeed simply by optimizing the $("body") selector because it’s called hundreds of times within the tests. Additionally we saw large gains by optimizing .bind() and .unbind() by a fraction of a millisecond – an inconsequential amount – especially considering that any cases where you would bind hundreds of events you would likely want to use .live() or .delegate() instead.

We’ve collected some results from the other major libraries as well but are less interested in those results and far more interested in the performance improvements that we’ve made relative to older versions of jQuery itself.

We will continue to work on optimizing the jQuery code base – indefinitely. It’s always a major concern for us to try and provide the fastest JavaScript/DOM-development experience possible. And yes, there will likely always be ways to gain additional performance – either through internal optimizations or by pushing critical functionality off into browser-land for standardization.

Event Rewrite

The largest internal changes have come through a much-needed structural rewrite of the events module. Many quirky issues related to event binding have been resolved with these fixes.

Namely event handlers are no longer stored as object properties in jQuery’s internal object store (with metadata attached to the handlers). Instead they’re now stored within an internal array of objects.

If you’ve ever had the opportunity to play around with .data("events") on a jQuery element you would find that it returns an object with all the event types currently bound, within it.

To enumerate some of the changes that have occurred during this rewrite:

  • It’s now possible to bind identical handlers with different data, namespaces, and event types universally.
  • Execution of event handlers will continue after one handler removes itself (or its sibling handlers).
  • We no longer attach data/namespace information directly to the event handlers (only a unique tracking ID).
  • We no longer use proxy functions, internally, to try and encapsulate handlers.
  • Execution order of events is now guaranteed in all browsers. Google Chrome had a long-standing error in their object-looping logic that has been routed around.

As a side-effect of these changes we had to change the newly-exposed special add/special remove APIs in order to accommodate the new event data objects. Ben Alman is in the process of writing up a large tutorial on jQuery’s special event system and we will be making additional announcements when that occurs.

Bug Fixes

There were a total of 40 tickets closed in this minor release. Some relating to differences between jQuery 1.3.2 and jQuery 1.4.x, some fixing long-standing issues (like in the case of the event module rewrite).

Raw Data

This is the raw data that we collected to generate the aforementioned charts.

	jQuery 1.3.2	jQuery 1.4.1	jQuery 1.4.2	Prototype 1.6.1	MooTools 1.2.4	Dojo 1.4.1	YUI 3.0.0
FF 3.5	2182	806	 565	 2156	 1073	 575	 1885
FF 3.6	1352	677	 519	 2067	 857	 750	 1494
Opera	983	697	 222	 793	 678	 218	 1201
Safari	610	435	 252	 315	 235	 238	 612
Chrome	1591	703	 293	 271	 312	 222	 745
IE 8	2470	1937	 1141	 3045	 4749	 1420	 2922
IE 7	4468	3470	 1705	 9863	 10034	 1737	 5830
IE 6	6517	4468	 2110	 13499	 11453	 2202	 7295

14 Days of jQuery Summary: Days 1 – 7

Posted on by

In case you’re not following along with the 14 days of jQuery, here’s a summary of what has been released thus far.

Pre Release Day 1

  • New jQuery API Site

Pre Release Day 2

  • jQuery 1.4rc1

Day 1

  • jQuery 1.4 Released
  • jQuery 1.4 Live Q&A

Day 2

  • HD version of jQuery 1.4 Q&A
  • Media Temple Giveaway
  • jQuery Podcast episode 7 with John Resig

Day 3

  • Internal Changes in jQuery 1.4, with John Resig

Day 4

  • Getting Involved in the jQuery Community, with Karl Swedberg

Day 5

  • appendTo Training Drawing
  • jQuery 1.4 Hawtness #1, with Paul Irish

Day 6

  • jQuery In The Enterprise

Day 7

  • New jQuery Forum
  • jQuery 1.4 Hawtness #2, with Paul Irish

We still have 7 more days of jQuery 1.4 to come with more video’s and more releases to announce.

Again, events like these are not possible without support from our great sponsors and from you, the jQuery Community. We’d like to thank everyone who has donated so far, and we’d like to remind everyone that you will receive a free ebook with the donation of $20 or more throughout the 14 Days of jQuery.

Media Template Giveaway

Each day during the 14 days of jQuery, a web developer will receive a free (gs) Grid-Service account for one year from the jQuery Project’s web hosting provider, Media Temple. A grand prize winner will receive a 13″ MacBook Pro!

In order to enter the contest, you must submit a link to your coolest use of jQuery. A winner will be chosen each day during the 14 Days of jQuery. The grand prize winner will be announced on Friday, January 29th.

Check the Media Template Giveaway webpage for more details about the contest and to see the announced daily winners. There are only 7 days left, so enter now!

Check out jQuery Enlightenment!

jQuery EnlightenmentjQuery team member Cody Lindley has published the jQuery Enlightenment book, and if you haven’t checked it out yet, you’ll definitely want to. “Each chapter contains concepts essential to becoming a seasoned jQuery developer,”‘” so even if you’ve already got your copy, pick one up for a friend who’s just learning! Even better, a percentage of all sales goes directly back to the jQuery project and helps fund future releases and projects. A big thank you to Cody for his generous donation for the 14 Days of jQuery campaign!

14 Days of jQuery and the New API Browser

Posted on by

It’s the start of a new year, and the jQuery team’s been hard at work. We’ve been up day and night working to crank out the upcoming jQuery 1.4 release, and there’s a LOT to announce! So much, in fact, that we’ll need fourteen full days to get it all out there… As such, I’d like to announce The 14 Days of jQuery 1.4!

The New jQuery 1.4 Site

Beginning on January 14th, we’ll start a fourteen-day event. Each day we’ll have fresh videos and announcements — there’ll be code releases, project-related updates, and jQuery UI goodness, among other things. In addition to the announcements, we’ll also be releasing a set of videos over the 14 days with talks and tutorials relating the jQuery 1.4 release and other general jQuery topics. You’ll want to check back at jQuery14.com every day during the two weeks to see what’s new, or sign up to be notified via email. Think of it like an online conference, only longer, freer, and with a bit of mystery and suspense!

But Wait, There’s More!

We’ve got a lot planned for January 14th, but it seemed good to whet your appetite and pre-release some tasty jQuery morsels. Head over to jQuery14.com to learn all about the brand-new jQuery API site:

Be sure to subscribe to the jQuery14.com site or to the @jquery Twitter account for all the updates during these upcoming weeks.

Free Books, Anyone?

The jQuery project is a non-profit, open-source effort, and we rely heavily on donations and contributions to help fund everything we do. We’ll be running a fundraising drive starting now and throughout the 14 Days of jQuery. If you’re a jQuery user, show your support by making a tax-deductible donation of $20 USD or more to the project during the event, and you’ll receive a free jQuery book with your donation.

It’s always important to mention that much of this would not be possible without the help of the jQuery project sponsors; Netflix, JupiterIT Consulting, appendTo, Fusionary Media and Oxide Design Co have all signed on as official sponsors of the 14 Days of jQuery 1.4, along with our favorite jQuery book publishers, Manning, Packt, jQuery Enlightenment, and O’Reilly.

That’s it for now — head on over to jQuery14.com for much more to come!

jQuery 1.3.2 released

Posted on by

Downloading

jQuery 1.3.2:
http://code.jquery.com/jquery-1.3.2.min.js minified (19kb with Gzipping)
http://code.jquery.com/jquery-1.3.2.js regular (120kb)

Changes

Elements Returned in Document Order

This is a change to jQuery’s selector engine that re-orders the returned results to be in document order, instead of the order in which the selectors were passed in. This change was done in order to be in compliance with the Selectors API specification (which jQuery uses, internally, in browsers that support it).

A sample result:

  // jQuery 1.3.1 (and older)
  $("h1, h2, h3")
  => [ h1, h1, h2, h2, h3, h3 ]

  // jQuery 1.3.2
  $("h1, h2, h3")
  => [ h1, h2, h3, h3, h1, h2 ]

I’d like to thank Diego Perini for pushing us to get this implemented.

.live() Can Now Prevent Bubbling

It’s now possible to call event.stopPropagation() or return false within a callback and have it stop the bubbling of the live event. This means that you can now bind live events inside each other and have the inner handlers prevent the outer handlers from firing.

For example:

  <ul>
    <li><b>Google</b></li>
    <li><b>Yahoo</b></li>
  </ul>
  <script>
    $("li").live("click", function(){
      $(this).addClass("active");
    });
    $("li b").live("click", function(){
      $(this).addClass("active");
      return false;
    });
  </script>

I’d like to thank Iraê for the solution that he proposed for this problem.

For those wondering about the, currently missing, features of .live() (like submit and change events) you can expect all of those to land in jQuery 1.3.3, due to arrive sometime next month.

:visible/:hidden Overhauled

We’ve changed the logic behind the :visible and :hidden selectors (which were used throughout jQuery to determine the visibility of an element).

This is how the logic has changed:
* In jQuery 1.3.1 (and older) an element was visible if its CSS “display” was not “none”, its CSS “visibility” was not “hidden”, and its type (if it was an input) was not “hidden”.
* In jQuery 1.3.2 an element is visible if its browser-reported offsetWidth or offsetHeight is greater than 0.

What does this change mean? It means that if your element’s CSS display is “none”, or any of its parent/ancestor element’s display is “none”, or if the element’s width is 0 and the element’s height is 0 then an element will be reported as hidden.

What is the benefit of making this switch? The result is two-fold:
* The performance is much, much, better. (See below.)
* An element is reported as “hidden” if it’s inside a “hidden” element (something that wasn’t possible before, without the use of a plugin.

I’d like to thank Matheus Almeida for proposing some of the changes that were implemented to improve the performance of these selectors.

.height()/.width() Overhauled

The width and height related selectors have all been overhauled – dramatically improving their speed in all browsers.

I’d like to thank Mike Helgeson for his contributions here which were largely responsible for some of the massive gains that we’re seeing in these methods.

Selector Speed-up in IE

The benefits of the new Sizzle selector engine are really starting to come to light as contributions from the larger JavaScript community come in. A number of additions have landed that have helped to improve the performance of the engine – especially in Internet Explorer.

I’d like to thank Fabio Buffoni for his contributions here which were largely responsible for these speed-ups.

.appendTo()/etc. Now Return Inserted Elements

This is a (minor) API change – resolving a bug in the jQuery API. The methods appendTo, prependTo, insertBefore, insertAfter, and replaceAll all now return the set of inserted elements, instead of the original set of elements.

To understand this change we need to look at a simple example.

Given the following markup, in jQuery 1.3.1 (and older) the following would occur:

  <div></div>
  <div></div>
  <script>
  $("<p/>")
    .appendTo("div")
    .addClass("test");
  </script>

The result in 1.3.1 (and older):

  <div><p class="test"></p></div>
  <div><p></p></div>

This was due to the fact that .appendTo, etc. would only return the elements that were passed in to it, instead of the elements that were actually inserted (and since only a single paragraph was passed in – the first one to be inserted – only the first paragraph had the class added to it).

Thus, if you were to run the same code in jQuery 1.3.2 you would end up with:

<div><p class=”test”></p></div>
<div><p class=”test”></p></div>

Which is the expected result. The only catch is that appendTo, prependTo, insertBefore, insertAfter, and replaceAll all now push onto the jQuery stack (meaning that they’re affected by .end().

We did a survey of existing uses of the above methods and could find no cases where this change would affect any existing code, so we felt safe going ahead with it (especially considering that it’s the expected behavior, to begin with).

Testing

We have a couple announcements with regard to our test suite and our testing methodology in the jQuery project.
* We are now fully supporting, and the test suite is completely passing in, Internet Explorer 8rc1 and Chrome 2 (Nightly) (in addition to our normal selection of browsers).
* The test suite has broken 1500 tests (1504, to be precise).

This means that we now actively test in – and pass the test suite in – 11 browsers: Chrome 1, Chrome Nightly, IE 6, IE 7, IE 8rc1, Opera 9.6, Safari 3.2, WebKit Nightly, Firefox 2, Firefox 3, Firefox Nightly.

(We’re waiting for the next beta of Opera 10 before we begin to support it fully, there are some critical problems with the current beta.)

To measure the performance of different portions of jQuery we used a modified copy of the SlickSpeed test suite to run our tests (adapted to handle non-selector tests). The raw results for the test runs can be found below (all times in milliseconds).

Selector Tests

We used a copy of the Yahoo home page (a representatively complex web page) and used a selection of selectors that people actually use. Targeting selectors that people currently use will help to improve the performance of both existing and future applications.

Frameworks	jQuery 1.2.6	jQuery 1.3	jQuery 1.3.2
IE 6		1059		799		626

:hidden/:visible Tests

We tested both the :hidden and :visible selectors on a number of elements in our test page.

Frameworks	jQuery 1.3	jQuery 1.3.2
Firefox 3	1512		190
Firefox 3.1	1202		161
Safari 3.2	592		80
Safari Nightly	334		43
Opera 9.6	1307		497
IE 6		1948		738
IE 7		1295		830
Chrome		490		30

width/height Tests

We tested both the width, height, innerWidth, innerHeight, outerWidth, and outerHeight methods on our test page.

Frameworks	jQuery 1.3	jQuery 1.3.2
Firefox 3	310		106
Firefox 3.1	281		84
Safari 3.2	146		37
Safari Nightly	166		32
Opera 9.6	345		116
IE 6		313		124
IE 7		283		123
Chrome		113		27

jQuery 1.3 Released

Posted on by

The jQuery team is pleased to release the latest major release of the jQuery JavaScript library! A lot of coding, testing, and documenting has gone in to this release and we’re really quite proud of it.

I want to personally thank Ariel Flesler and Brandon Aaron who put a lot of work into fixing bugs and getting the release out the door.

Overview

There have been a number of major changes in jQuery 1.3, these are a few of the largest and most prominent changes.

Sizzle Selector Engine

jQuery has a brand new CSS selector engine – nicknamed Sizzle. We wanted an engine that was:

  1. Faster than our current engine for the most commonly used selectors.
  2. Fully extensible (we had to sacrifice some of our extensibility in favor of performance in past versions of jQuery).
  3. Completely standalone.

As far as performance is concerned, we’ve done quite well, coming in about 49% faster than our previous engine:

This is especially surprising considering that the engine in 1.2.6 was already pretty fast and that we gained a great deal of extensibility in the process.

One thing that became very obvious during the development of the new engine: We wanted to be able to collaborate on it with other libraries and developers. We saw an opportunity for some solid collaboration with some of the best JavaScript developers – the result of which will help users of all libraries. For this reason we made sure that Sizzle was able to work completely standalone (no dependencies).

Additionally, as a sign of good faith and willingness to collaborate, we’ve released the source code to Sizzle to the Dojo Foundation. We wanted a common meeting ground where everyone would be able to work together and under which there would be a clear long-term copyright holder.

Right now we’re working with Prototype, Dojo, Yahoo UI, MochiKit, and TinyMCE (and many others) on Sizzle, honing it to perfection.

Live Events

jQuery now supports “live events” – events that can be bound to all current – and future – elements. Using event delegation, and a seamless jQuery-style API, the result is both easy to use and very fast.

More information about live events can be found in the .live() documentation.

When working on live events we wanted a solution that was going to be fast and scale well. To do this we needed a selector engine designed to handle delegation element filtering (roughly speaking “does this selector match this element”). The new Sizzle selector engine blew away all of our expectations – coming in almost 30x faster than our previous solution:

By using advanced filtering techniques we’re able to bring you an event delegation solution that won’t bog down your browser and will scale to dozens or hundreds of delegations on a page at a time.

jQuery Event Object

Ariel Flesler brought some serious refactoring of the jQuery event system to jQuery 1.3. The bulk of this change came down to the new jQuery.Event object. This object completely encapsulates all of the functionality normally found in a W3C-compliant event object implementation and makes it work smoothly across all browsers.

There were a number of individual changes related to the event system, as well, and those are described in-depth later on in the event section.

HTML Injection Rewrite

All of the code related to injecting HTML into a document (such as the append, prepend, before, and after methods) has been overhauled. When we were analyzing jQuery applications we found this to be one of the most common bottlenecks – and thus was in direct need for an improvement. The functionality provided is identical to what was in previous releases of jQuery but with the added benefit of being much, much faster (about 6x faster overall):

We also overhauled the creation of DOM elements (e.g. $("<script/>")) and made it identical to calling $(document.createElement("script")) (it’s both faster and saner as a result).

Offset Rewrite

Brandon Aaron felt that a full rewrite of the .offset() method was due for 1.3. Re-written from scratch, it not only handles cross-browser issues better, but does so much faster:

Seeing an almost 3x jump in performance over the offset method in 1.2.6 this rewrite is sure to make your complex interactions go that much more smoothly.

No More Browser Sniffing

The final major feature of this release is one that you probably won’t ever see or deal directly with but it’s an important change that’ll help to make jQuery last longer and with less bugs: As of 1.3, jQuery no longer uses any form of browser/userAgent sniffing internally – and is the first major JavaScript library to do so.

Browser sniffing is a technique in which you make assumptions about how a piece of code will work in the future. Generally this means making an assumption that a specific browser bug will always be there – which frequently leads to code breaking when browsers make changes and fix bugs.

Instead we use a technique called feature detection where we simulate a particular browser feature or bug to verify its existence. We’ve encapsulated all the checks that we use in jQuery into a single object: jQuery.support. More information about it, feature detection, and what this feature provides can be found in the documentation.

It’s important to note that jQuery.browser is still in jQuery – and will be for the foreseeable future (too many plugins and pieces of code depend on it). That being said we’ve deprecated it in an attempt to encourage you – and all JavaScript developers – to seriously consider using feature detection in your code.

Upgrading

With jQuery 1.3 we attempted to minimize any large upgrade hassles – maintaining all existing public APIs. That being said, please read through the list of potentially-breaking changes to be aware of what might cause problems in your applications.

Note: Many plugins are providing updated releases to coincide with jQuery 1.3. If you’re having difficulties with a particular plugin please be sure to see if a new release has arrived. Specifically both jQuery UI and the Validation plugin have updated releases that work with jQuery 1.3.

Downloading

As usual, we provide two copies of jQuery, one minifed (we now use YUI Compressor as the default minifier) and one uncompressed (for debugging or reading).

http://code.jquery.com/jquery-1.3.min.js jQuery Minified (18kb gzipped)
http://code.jquery.com/jquery-1.3.js jQuery Regular (114kb)

Additionally, Google has provided us with a copy of jQuery hosted on their servers. This copy of jQuery is automatically minified and gzipped – and served from Google’s fast edge cache servers.

http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js

You can feel free to include the above URL directly into your site and you will get the full performance benefits of a quickly-loading jQuery.

Changes

The following are changes that were made that may have a remote possibility to cause backwards compatibility issues in your web pages.

  • The ‘@’ in [@attr] has been removed. Deprecated since 1.2 this old syntax no longer works. Simply remove the @ to upgrade.
  • Triggered events now bubble up the DOM. Unsuspecting event handlers may accidentally capture more events than they’re expecting.
  • The ready() method no longer tries to make any guarantees about waiting for all stylesheets to be loaded. Instead all CSS files should be included before the scripts on the page.
  • .isFunction is simpler now, it no longer handles some strange edge cases (in favor of simplicity and performance).
  • The order of “a, b, c” style selectors may change. Browsers that support querySelectorAll (Safari, Firefox 3.5+, Opera 10+, IE 8+) will return the elements in document order, other browsers will (currently) return them in the order specified. In 1.3.2 and later release all comma-separated selectors will be returned in document order.
  • The trigger and triggerHandler methods no longer accept event objects within the data array. Instead they should be specified directly as an argument.
  • The undocumented ‘extra’ function is gone from trigger and triggerHandler functions as well.
  • The internal jQuery.event.trigger no longer returns the last item returned by a handler, instead it return true or false as per the W3C specification. You should use a jQuery.Event object to capture the specific return value.
  • You should always be sure to run your page in standards mode. There are known issues with methods not working correctly in quirks mode.
  • An old (deprecated) style of creating selector plugins has been removed. Previously you could create string-encoded plugins which were later turned into functions – this has been removed – please just create the functions directly.
  • jQuery.param(obj) execute obj’s functions instead of converting them to a String.

The following properties have been deprecated (in favor of feature detection and jQuery.support, as discussed in the Overview: jQuery.browser, jQuery.browser.version, jQuery.boxModel.

The following browsers are no longer supported: Safari 2

Performance

To measure the performance of different portions of jQuery we used a modified copy of the SlickSpeed test suite to run our tests (adapted to handle non-selector tests). The raw results for the test runs can be found below (all times in milliseconds).

We used a copy of the Yahoo home page (a representatively complex web page) and used a selection of selectors that people actually use. Targeting selectors that people currently use will help to improve the performance of both existing and future applications.

Frameworks	jQuery 1.2.6	jQuery 1.3	Dojo 1.2.3	MooTools 1.2.1	Prototype 1.6.0.3
Firefox 3	184		111		147		240		137
Firefox 3.5	113		34		105		135		55
Safari 3.2	71		15		64		76		50
Safari Nightly	46		15		65		47		18
Opera 9.6	107		75		73		132		87
IE 6		854		640		561		1611		3174
IE 7		210		181		150		490		761
Chrome		30		13		23		118		10

Delegation Filtering Tests

To test delegation filtering we attempted to see if a given element matched a selector. jQuery 1.3 and Prototype provided native methods for handling this (.is and .match, respectively) whereas jQuery 1.2.6, Dojo, and MooTools all used a “run a selector and see if an element is in the results” technique.

Frameworks	jQuery 1.2.6	jQuery 1.3	Dojo 1.2.3	MooTools 1.2.1	Prototype 1.6.0.3
Firefox 3	3260		199		1630		3798		763
Firefox 3.5	1047		113		620		1101		298
Safari 3.2	1169		91		820		1223		188
Safari Nightly	911		65		294		590		125
Opera 9.6	1764		167		898		1976		451
IE 6		22142		1201		13000		17227		12827
IE 7		4908		341		2664		5497		2994
Chrome		959		125		700		939		153

DOM Manipulation Tests

These tests analyze the performance of inserting DOM fragments (in the case of jQuery and Prototype this is HTML, for MooTools it was using their Element class). Dojo didn’t provide any explicit helpers for injecting HTML or constructing DOM elements so it was excluded.

Frameworks	jQuery 1.2.6	jQuery 1.3	MooTools 1.2.1	Prototype 1.6.0.3
Firefox 3	161		41		47		323
Firefox 3.5	113		31		42		78
Safari 3.2	77		10		25		41
Safari Nightly	87		22		22		31
Opera 9.6	130		23		36		84
IE 6		710		110		600		971
IE 7		560		60		330		460
Chrome		49		14		23		21

.offset() Tests

Ran the jQuery .offset() method on a number of elements.

Frameworks	jQuery 1.2.6	jQuery 1.3
Firefox 3	142		30
Firefox 3.5	45		23
Safari 3.2	92		18
Safari Nightly	75		39
Opera 9.6	39		26
IE 6		151		70
IE 7		100		50
Chrome		115		21

.hide()/.show() Results

Ran the .hide() and .show() methods on a number of elements.

Frameworks	jQuery 1.2.6	jQuery 1.3
Firefox 3	2680		722
Firefox 3.5	1867		448
Safari 3.2	1015		577
Safari Nightly	532		306
Opera 9.6	2327		1173
IE 6		8242		2715
IE 7		1912		961
Chrome		1922		551