jQuery 1.7 Has Been Released

The latest version of jQuery went live yesterday. The big news in this version is a significant change to the event model. The code you’ve learned in Learning Tree classes still works – but it is now legacy code. Your apps will run more quickly if you move to the new model. It’s also simpler – hurray!

In a previous blog post, I waxed lyrical about the benefits of using the .delegate() approach rather than .bind() or .live(). Now you don’t have to learn a new method to take advantage of delegation – .delegate() is also subsumed inside the new methods.

The switch to using the new methods is simplicity itself. The signature of your methods changes very little. You just need to replace .live() or .bind() or .delegate() with .on() – and, if you want to switch it off, .off(). Like this:

code sample

Replacing the .delegate() method is trivially more difficult, as you need to re-order the arguments. With .delegate(), the selector comes first and the event name second. With .on(), the arguments are reversed.

code sample

The other good news is that this new model isn’t just simpler – it’s also more efficient with delegated events, which are about twice as fast as in the previous release..

So, with jQuery 1.7 out, can jQuery mobile be far behind?

Kevin Rattan

For other related information, check out these courses from Learning Tree:

HTML5: Next Generation Web Development

JavaScript for Web Development

Building Web Applications with ASP.NET MVC

Building Web Applications with ASP.NET and Ajax

Type to search blog.learningtree.com

Do you mean "" ?

Sorry, no results were found for your query.

Please check your spelling and try your search again.