Javascript Behaviors on HTML

Just came across Behaviour : Using CSS selectors to apply Javascript behaviours:

After all the work of WASP and others to promote clean markup, valid pages and graceful degradataion via css – it sucks that we’re going back to tag soup days by throwing javascript tags into our html.

The better way to do javascript is to do it unobtrusively. PPK and Simon Willison have been recommending this approach for ages. And it’s definitely the way to go. The only problem is that it’s a bit of a pain in the ass.

That’s why I came up with Behaviour – my solution to unobtrusive javascript behaviours.

He goes on to describe a Javascript library he’s created to abstract the connections between behavioral stuff in Javascript and the (X)HTML stuff its operating on. His interaface? CSS selectors. Beautiful.

Via O’Reilly Radar

One Response to “Javascript Behaviors on HTML”

  1. Ben Says:

    Thanks for the link. :)