Dojo 1.4 Released with Improved Performance and Stability
The Dojo team announced the release of Dojo 1.4 which has improvements in performance and stability as well as new features.
While this release is primarily a stability and performance release, we managed to sneak quite a bit of great new functionality into the various projects. All the significant changes have been outlined in the 1.4 release notes (including migration issues), and are far too numerous to list here: ranging from simple convenience changes, like dojo.Animation callbacks now being passed the node being animated, to completely new APIs like dojo.cache providing build interning outside of of dijit._Templated. Some changes are simply exposing long standing "private" API's: dojo._Animation is public as dojo.Animation now and dojo._contentHandlers has become dojo.contentHandlers exposing Ajax transport configuration for advanced users and giving an official commitment to the preservation of those APIs.
The author of this article, has tried TaskSpeed with Firefox 3.5.5, which reported that the sample test takes 687ms with Dojo 1.4 instead of 701ms with version 1.3.2. On a virtual machine with IE 8 the same numbers become 2613ms and 2694ms.
It also seems that the Dojo DOM APIs will become more similar to what is available in jQuery, as James Burke describes:
One of the things I want to do for Dojo Core is to bring the DOM APIs, particularly the methods on dojo.NodeList (the return object for dojo.query() calls, Dojo's CSS selector method) more in-line with what is available in jQuery. jQuery has demonstrated that its APIs resonate strongly with developers. Where it makes sense and fits Dojo's philosophy, we should also provide those APIs, to make it easier for developers. These Dojo 1.4 changes reflect that goal:
- dojo.ready(), just an alias for dojo.addOnLoad().
- dojo.NodeList-traverse: A helper module that adds methods to dojo.NodeList. Its goal is to bring in some methods to NodeList that exist in jQuery for DOM traversal, specifically: children, closest, parent, parents, siblings, next, nextAll, prev, prevAll, andSelf, first, last, even, odd.
- dojo.NodeList-manipulate: A helper module that adds methods to dojo.NodeList. Its goal is to bring in some methods to NodeList that exist in jQuery for DOM manipulation, specifically: innerHTML, html, text, val, append, appendTo, prepend, prependTo, after, insertAfter, before, insertBefore, remove, wrap, wrapAll, wrapInner, replaceWith, replaceAll, clone.
- IO pipeline topics: get notifications of IO events via dojo.subscribe/dojo.publish. Handy for putting up a generic "loading" indicator when any sort of IO call happens. These topics are not strictly how jQuery exposes this functionality, but we can leverage the power of dojo.publish/subscribe to implement this feature.
InfoQ had a small Q&A with Dylan Schiemann, CEO of SitePen and co-creator of the Dojo Toolkit, about the latest release:
InfoQ: What where the highlights for you in this release?
Dylan: The highlights to me are outlined at http://www.sitepen.com/blog/2009/12/10/dojo-1-4-released/
- IO Pipeline topics
- dojo.hash with native HTML5 onhashchange event support where available
- Traversal and manipulation for NodeLists (the return value for dojo.query)
- dojo.ready (easier to type than dojo.addOnLoad)
- Hundreds of refinements to the Dijit API and collection of Dijits, and a few new widgets in DojoX
- DataChart widget and other improvements to charting
- dojox.drawing lands!
- Editor improvements and new plug-ins in both Dijit and DojoX
- Grid is faster, and the EnhancedGrid lands!
- ForestStoreModel for the TreeGrid
- GFX improvements
- dojox.jq, a very experimental module aimed at trying to match the jQuery API as close as possible, but using Dojo underneath
- Dojo build system optionally supports the Google Closure Tools compiler
- Significant speed improvements, especially in IE
The major grid improvements and enhancements, and the introduction of dojox.drawing are very impressive, as well as major core improvements in IE performance all around
InfoQ: It seems that you have dropped support for Firefox 2 and are only supporting the latest versions of Safari, Chrome and Opera (Core functionality only). Do you feel that this is enough? What about the mobile platforms?
Dylan: When we drop support for a browser, it doesn't mean it doesn't work, it just means we don't run it through a QA/testing cycle. If there are bugs that break older versions of FF, we'll generally still address them. For Safari and Opera, these users generally auto-update so we believe it's ok, but again, if users report issues, we'll generally fix them even for unsupported browsers. This is somewhat like YUI's distinction between first and second class browser support.
InfoQ: With the release of Dojo 1.4, James Burke expressed his interest to bring the DOM APIs "more in-line with what is available in jQuery". How is this relevant to the work being done with plugd which has been describbed by Peter Higgins as his "favorite bits of jQuery"? Do you feel that these two frameworks are going to get even closer?
Dylan: The work on plugd, the dojox work for jquery API compatibility, and the work on dojox.jq are all meant to address the goal of developer productivity with the DOM. jQuery offers a nice API for DOM manipulation, and we want to support our users. plugd was the first attempt at this, and the work in dojox is the first step towards moving some of this into Dojo. Eventually the important pieces will make their way into Dojo Core once they are well tested, highly performant, and the API is stable.
Further details about the release can be found in the release notes and the documentation. Dojo is released under a BSD License and version 2.1 of the Academic Free License and is available for downloading or from two CDNs.
Ruslan Meshenberg Sep 21, 2014