Monday, 21 April 2008

Dojo from the Air

While I'm sitting here 35,000 feet above the Tasman I thought it'd be a good time to update you all on the goings on in the world of Dojo from my point of view.

1.1!

Dojo released 1.1 after a lot of hard work. The team worked really hard to get this release out, and it adds a lot of polish to 1.0 and a number of cool new features. Some quick snippets from me:

dojo.attr()

We now have a smooth & nice way to access attributes on DOM elements, normalising access much in the way dojo.style() does. And, just like dojo.style() can now, if you pass in an object as the name, it'll set a bunch of attributes for you in one go:


// get the current value of the "foo" attribute on a node
dojo.attr(dojo.byId("nodeId"), "foo");

// we can just pass the id:
dojo.attr("nodeId", "foo");

// use attr() to set the tab index
dojo.attr("nodeId", "tabindex", 3);

// set multiple values at once, including event handlers:
dojo.attr("buttonId", {
"name": "myButton",
"value": "123",
"onclick": function(e){
// an onclick handler connected via dojo.connect()
}
});
api.dojotoolkit.org

Our API browser is back, newer and better. You can search and browse all the code in Dojo, see method arguments and examples, and dig into the code if necessary. And when you figure out a tip you can comment in the appropriate place to help others out. We think this is a fantastic addition, and I've been using it on a daily basis for a while now.

dojox.help


Not really part of 1.1, but happened about the same time. The talented Neil Roberts whipped up an awesome demo based on some suggestions from a dojo cookie. Basically it accesses the API site live and allows you to get method arguments and descriptions directly in Firebug. I often get some code semi-working and test and experiment using the Firebug console while I finalise it, so this is a real boon.

Let's have a go:
  1. load this page in Firefox with Firebug enabled
  2. in the Firebug console, type the following:
    • dojo.require("dojox.help.console") // loads the help infrastructure
    • dojo.attr // prints the method arguments for dojo.attr()
    • dojo.attr.help() // prints the method description, examples, etc
  3. revel in its coolness, dig in if you're using trunk, or wait patiently for it to appear in 1.2
Summer of Code

On Monday the Summer of Code students for 2008 will be announced. Dojo received a huge pile of great applications, and we had a really hard time evaluating and ranking them. Unfortunately the funding isn't infinite and neither is our mentoring capacity, so we've chosen what we think is a pretty exciting mix of projects. More to follow next week after the announcements!

The coding exercise we set went down pretty well. I suspect many of the students spent a lot more time on it than we asked, but there are some damn cool demos in there, which I'll try to show off over the next few weeks. Next year we'll try something a little more focussed, but its actually fairly tricky to think up the right balance.

Anyway, time to land now. Better be off. :)