Thursday, April 10th, 2008

Dojo 1.1 Nice Features

Category: Dojo

Alex Russell has written up some of the features of Dojo 1.1 that may not shout out at you in the release notes:

Core

I should mention a couple of Core features from 1.1 that might otherwise go overlooked, though. The first is a lack of visible change. Dojo Core and Dijit from 1.1 are fully backwards compatible with 1.0. We promised that the fundamental incompatibility between 0.4.x and 0.9.x+ was a one-time change, and Dojo 1.1 keeps that promise. We’ve already had reports during the RC cycle of people swapping out Dojo 1.1 for 1.0 without any changes to their apps. It takes dedication and discipline across the entire team to achieve that kind of API stability while still taking risks to deliver better features, reliability, and performance.

Animation

In Dojo 1.0, we moved to a unified timing loop for animations which helped to significantly improve the performance of Dojo animations. In 1.1, we’ve again improved the performance of the animation system but have also added some great syntactic sugar to the already powerful APIs which we expose. As always, start and end coordinates for an animation can be values or functions which return calculated starting and ending positions. Now, though, you can elide away the { end: 30 } structure and just provide a value. This lets us go from:

javascript

  1. dojo.animateProperty({
  2.     node: "thinger",
  3.     duration: 500,
  4.     properties: {
  5.         width: { end: 500 },
  6.         height: { end: 500 }
  7.     }
  8. }).play();

all the way too:

javascript

  1. dojo.anim("thinger", { width: 500, height: 500 }, 500);

XHR

Dojo now has a unified dojo.xhr() function that covers a lot of bases and gives you a single entry point into the various bits of XHR goodness contained in dojo.js.

CSS Selectors

Dojo is also now supporting querySelectorAll on the browsers that support it sanely. Dojo’s CSS engine has always been fast, and by keeping our query syntax to just what CSS provides, we’ve avoided getting ourselves into a situation where we’ll always need to be shipping such a query engine down the wire. Sooner or later, dojo.query() will become nothing more than a call into querySelectorAll plus some syntactic sugar on the returned array. Best yet, API won’t change and you can get the speedup on the browsers that support it now, knowing full-well that things will only get faster and smaller in the future. An investment in a toolkit that is pays attention to the evolution of the web is already paying dividends for Dojo users.

Lastly (for now), there have been some fun additions to the API of dojo.NodeList, the thing that’s returned out of every call to dojo.query(). dojo.attr() and dojo.anim() are now available on groups of nodes. For instance, we can make a group of elements tab-focusable on browsers that support it and then draw some attention to them:

javascript

  1. dojo.require("dojo.NodeList-fx");
  2.  
  3. dojo.query("#nav > .focusable").
  4.     attr("tabIndex", 0).
  5.     style("border", "1px solid transparent").
  6.     anim({
  7.         "borderColor": { start: "yellow", end: "white" }
  8.     });

He also points to AOL WebMail upgrading to Dojo 1.x and shouts out:

Dojo 1.x is now powering the UI of the world’s largest mapping service, one of the world’s largest email services, the most useful personal information service anywhere, and the front-end of my favorite RSS reader.

Other Dojo 1.1 Resources

Posted by Dion Almaer at 8:11 am
7 Comments

++++-
4.1 rating from 28 votes

7 Comments »

Comments feed TrackBack URI

Wow, the effect transition instantiations are looking awfully Moo-ish! Dojo has gotten way better since the pre-1.0 releases, gotta give ’em that.

Comment by csuwldcat — April 10, 2008

Hey Ajaxian guys. Can you alter the WP theme so that all the content is visible? Not only are your article images commonly overflowing the content area, but now your code boxes are too, and it’s impossible to scroll to see their entire contents. Seriously, I know CSS is “hard” but it’s not that bad.

Comment by Trevor — April 10, 2008

The instantiations looks more like Scriptaculous syntax.

Comment by Jordan — April 11, 2008

The instantiations are looking an awful lot like other instantiations that already existed in Dojo.

Comment by pottedmeat — April 11, 2008

Hrm.. we found issues in dijit.form.TextBox, where it no longer supports “onKeyUp” and “onKeyPress”.. completely undocumented (unless you looked at source…) This broke a number of our custom widgets (composits).

Comment by TheCatWhisperer — April 11, 2008

@TheCatWhisperer: FWIW, That bug has been reported, and will be fixed in the branch release 1.1.1 soon. A workaround has been provided in trac (if in fact it’s the same bug). Otherwise, please file a new bug indicating this regression, so we can address it immediately.

#6489 is the regression.

Comment by phiggins — April 11, 2008

dojotoolkit.org crashes Firefox Mac OS X instantly. Here’s the Mac OS X crash report: http://jaime.bueza.com/firefox_crash.txt

Steps to reproduce:

1) visit dojotoolkit.org

Summary:

Firefox 2.0.0.13, Mac OS X, plugins: latest version of Firebug, yslow 0.9.4, web developer plugin. If I disable Firebug, going to dojotoolkit.org doesn’t crash the browser. I am assuming that Dojo has some code that Firebug doesn’t like, ultimately crashing Firefox.

Comment by MezZzeR — April 13, 2008

Leave a comment

You must be logged in to post a comment.