jQuery 1.7 Released

jQuery 1.7 is ready to download! You can download jQuery CDN:

Also, this release will be available to download from Google and Microsoft CDNs within a day or two.

JQuery team thanks all who have participated in the testing and finding bugs in the beta-versions, as well who believes in the strength and stability of the release. In addition, they are asking anyone who finds any bugs to report about them on the bug-tracker, and if it is possible to do the replay tests on jsFiddle for the faster problem analysis.

What is new in the version 1.7

You can quickly review a short list of new features on jQuery API with a tag 1.7, and below is given a description of version 1.7 innovations, as well as some things that are not included in the documentation for API.

New API events: .on() и .off()

New .on() и .off() API makes more universal and convenient binding to the events in the document.

$(elements).on( events [, selector] [, data] , handler );
$(elements).off( [ events ] [, selector] [, handler] );

When a selector is specified, then the method .on () works the same way as .delegate () - it binds the event handling, filtering elements by a selector. If the selector is not specified or is equal null, then the call works as usual .bind (). There is some ambiguity: if the argument data is a string, it is needed to submit an argument selector as a string or null, that data had not been mistaken for a selector. You should not worry much about specifying the selector when submitting a data object.

All existing types of bindings to events (and corresponding methods of unbinding from events) are available in version 1.7, but it is recommended to use .on () for new projects, where is guaranteed that the version 1.7 or older will be used. Below are some examples that demonstrate the similar bindings to events with the use of old and new API:

$('a').bind('click', myHandler);
$('a').on('click', myHandler);

$('form').bind('submit', { val: 42 }, fn);
$('form').on('submit', { val: 42 }, fn);


$('.comment').delegate('a.add', 'click', addNew);
$('.comment').on('click', 'a.add', addNew);

$('.dialog').undelegate('a', 'click.myDlg');
$('.dialog').off('click.myDlg', 'a');

$('a').live('click', fn);
$(document).on('click', 'a', fn);

$(document).off('click', 'a');

Improved performance of the delegated events

Event delegation has become increasingly important as size and complexity of pages grow. Application frameworks such as Backbone, JavaScriptMVC, and Sproutcore make heavy use of event delegation. With that in mind, jQuery 1.7 event handling was refactored with an eye to making delegated events much faster, especially for the most common cases.

In order to optimize the code for the most commonly used forms of selectors, we examined a cross-section of code from Google Codesearch. Nearly two-thirds of the selectors used in .live() and.delegate() method calls were in the form tag#id.class where one or more of tag, id, or class were used. By parsing those simple selectors in JavaScript at the time the event was attached, we were able to outperform even the browser’s native-code implementations ofmatchesSelector during event delivery. For more complex selectors we still use the Sizzle engine, so all existing code should continue to work.

The final result is that delegated events are delivered in about half the time they took in 1.6.4:


Improved support for HTML 5 in IE 6/7/8

Anyone who has tried to use the new tags from HTML5, such as <section> for sure had problems with the fact that IE 6/7/8 does not accept and remove these tags from the document. jQuery 1.7 has built in support for HTML5 tags for the older IE in methods, such as .html (). This mechanism is implemented at the same level as before innerShiv. It is still need to include HTML5Shiv in the head section of the document to support HTML5 tags in the older IE. Details are available on The Story of the HTML5 Shiv.

Intuitive work of toggling animations

In previous versions of jQuery, toggling animations such as .slideToggle() or .fadeToggle() would not work properly when animations were stacked on each other and a previous animation was terminated with .stop(). This has been fixed in 1.7 so that the animation system remembers the elements’ initial values and resets them in the case where a toggled animation is terminated prematurely.

Asynchronous Module Definition (AMD)

jQuery now supports the AMD API. Note that jQuery 1.7 is not a script loader itself; it cooperates with AMD-compliant loaders such as RequireJS or curl.js so it can be loaded dynamically and theready event can be controlled by the loader. Now an AMD-compliant loader can load an unmodified version of jQuery 1.7 from a CDN such as Google’s or Microsoft’s. There are many thanks to James Burke (@jrburke) who submitted the patch and unit tests, then waiting patiently for us to incorporate them.


The jQuery.Deferred object has been extended with new progress handlers and notification methods that call those handlers. This allows you to asynchronously notify listeners of progress in a request without resolving or rejecting the request. In addition, there is a new state() method that returns the current state of the Deferred; it’s primarily useful for debugging.

Deferreds are now implemented using a new jQuery.Callbacks feature, a generalized way of queueing and triggering a series of handlers. This feature may be of interest to plugin writers, although Deferreds and the event subsystem provide a higher-level interface for this type of functionality.

jQuery.isNumeric ()

Inside jQuery we’ve found several situations where we need to know if an argument is numeric, or would be successfully converted to a number if it is some other type. We decided to write and document jQuery.isNumeric() since it’s a useful utility. Pass it an argument of any type and it returns true or false as appropriate.

Remote features

event.layerX and event.layerY: We have removed these non-standard properties in version 1.7. Although we normally would have gone through a deprecation notice period for these, Chrome version 16 generates a flood of console warning messages on the page. Because of this, we decided to remove them immediately. On platforms that still support these properties, they are available through event.originalEvent.layerX and event.originalEvent.layerY.

jQuery.isNaN (): This undocumented utility function has been removed. It was confusing because it appropriated the name of a built-in JavaScript function but did not have the same semantics. The new jQuery.isNumeric() serves a similar purpose, but has the benefit of being documented and supported. Despite jQuery.isNaN() being undocumented, several projects on Github were using it. We have contacted them and asked that they use jQuery.isNumeric() or some other solution.

jQuery.event.proxy (): This undocumented and deprecated method has been removed. Users should be calling the documented jQuery.proxy method instead.

Other thanks and change log with a list of all bugs can be read at the end of the original article blog.jquery.com/2011/11/03/jquery-1-7-released/
Tags: jQuery
Pirat 5 november 2011, 14:35
Vote for this post
Bring it to the Main Page


Leave a Reply

Avaible tags
  • <b>...</b>highlighting important text on the page in bold
  • <i>..</i>highlighting important text on the page in italic
  • <u>...</u>allocated with tag <u> text shownas underlined
  • <s>...</s>allocated with tag <s> text shown as strikethrough
  • <sup>...</sup>, <sub>...</sub>text in the tag <sup> appears as a superscript, <sub> - subscript
  • <blockquote>...</blockquote>For  highlight citation, use the tag <blockquote>
  • <code lang="lang">...</code>highlighting the program code (supported by bash, cpp, cs, css, xml, html, java, javascript, lisp, lua, php, perl, python, ruby, sql, scala, tex)
  • <a href="http://...">...</a>link, specify the desired Internet address in the href attribute
  • <img src="http://..." alt="text" />specify the full path of image in the src attribute