Home & blog  /  2012  /  Aug  /  view post  /

Article by me in next issue of .NET

posted: 06 Aug '12 18:19 tags: .NET, jQuery, deferred

You might recall I did a tutorial last year for .NET Magazine, an introduction to regular expressions. Well, the next issue (?) will feature another one from me - this time, a jQuery catch-up piece.

The premise is this: many developers got comfy with earlier versions of jQuery. A scout around some big traffic sites proves this; many are still on 1.4 or 1.5.

But jQuery hasn't sat still; it has developed, and at some pace. The article will look in turn at jQuery 1.5, 1.6 and 1.7, covering some of the main features in each release:

Deferred objects

I'm a particular fan of the deferred objects concept, and jQuery's implementation of it is a good one. They offer a wealth of flexibility with regards to how you approach callbacks to asynchronous - or even synchronous - operations. These arrived in jQuery 1.5 as part of a major overhaul to jQuery's AJAX module, and are therefore probably the most notable feature of jQuery in recent years.

In the article I'll show not only how they can be used with AJAX (their most common haunt) but also for situations other than AJAX. I demonstrated this here a few months ago when I showed how deferreds could be used to make an interactive word game.

Word game made with jQuery

Attributes vs. properties

1.6 was a quieter affair; no new major features, but a handy tidy-up of how jQuery handles attributes vs. properties. Until 1.6, both had been dealt with via the attr() method. Whilst helpful, this unhelpfully gave the impression that attributes and properties were one and the same.

If you're not sure of the difference, I go into it fully in the article.

on() / off()

Of course the big arrival in 1.7 was an encapsulated approach to events. By 1.7 the events API had got pretty messy, with all sorts of methods kicking around. 1.7 introduced on() and off(). The former can be used for both direct and delegated events, such that no other method is required (previously, if you wanted to delegate, you had to look at live() or delegate()).

XMLPlayground

While we're talking about .NET, I was pleasantly alerted on Twitter today to the fact that they featured my very own XMLPlayground.com in their list of top recent tools. Happy days!

post new comment

Comments (1)

Internet Libel, at 2/09/'12 12:36, said:
Nice article very useful indeed.