jQuery 1.7 Introduces On/Off Switch
Written by Ian Elliot   
Monday, 07 November 2011

New event APIs in jQuery 1.7 provide for an improved, and quicker, way to bind to events and refactoring has led to improved delivery performance on delegated events.

According to jQuery blog, the major "big item" in jQuery 1.7 is the the inclusion of new event APIs, .on() and.off() that unify all the ways of attaching events to a document in jQuery and have the advantage of being shorter to type!

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

When a selector is provided, .on() is similar to .delegate() in that it attaches a delegated event handler, filtered by the selector. When the selector is omitted or null the call is like .bind(). There is one ambiguous case: If the data argument is a string, you must provide either a selector string or null so that the data isn’t mistaken as a selector. Pass an object for data and you’ll never have to worry about special cases.

Although all the existing event binding and unbinding methods are still available, the use of .on() and.off() is recommended for new projects and the blog has examples of mapping between them and the older methods.

jQuery 1.7 event handling has been refactored to making delegated events faster and the result reported in this chart is that delegated events are delivered in about half the time they took in 1.6.4.

jq17

This release also offers better support for HTML5 in older versions of Internet Explorer to overcome the problem that IE 6/7/8/ strip out  new HTML5 tags such as <section>. It also fixes a problem that earlier releases had with toggling animations.

Three other enhancements are that jQuery now supports the AMD API; the jQuery.Deferred object has been extended with new progress handlers and notification methods; and there is a new method  jQuery.isNumeric()to discover  if an argument is numeric - pass it an argument of any type and it returns true or false as appropriate.

 

More information

JQuery 1.7 Released

List of all API changes.

Dowload the code from the jQuery CDN (Content Delivery Network) at http://code.jquery.com/jquery-1.7.js (or in minified form http://code.jquery.com/jquery-1.7.min.js).

 

 

To be informed about new articles on I Programmer, subscribe to the RSS feed, follow us on Twitter or Facebook or sign up for our weekly newsletter.

 

Banner


Break This Robot Apart And It Reassembles
06/04/2014

This is terrifying - a robot that you can't destroy. If you break it by kicking it to pieces then the pieces simply move towards each other and reassemble.
Is this science fiction or gothic horror mad [ ... ]



Google Refuses DARPA Money But Still In Competition
24/03/2014

When Google bought the winner of the DARPA Robot Challenge the rumour was that it would withdraw the robot from further competition rather than accept money for the project from the military. Now we s [ ... ]


More News

Last Updated ( Monday, 07 November 2011 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.