Test Driving DED|Chain
I have been using the JQuery JavaScript library for a while now. I enjoy working with this library because it’s small (~19k), it has strong CSS support, and it has good cross browser support. Recently Dustin Diaz released his DED|Chain JavaScript library, built on the Yahoo! UI library, and I figured I would give it a test drive.
Initial Reactions
The functionality provided by DED|Chain seems to be relatively small, however when you think about the fact that the library is built on top of YUI, functionality becomes a non issue. It does leave a substantially larger footprint than JQuery (it takes ~70k to run DED|Chain vs. ~19k for JQuery), however ~63k of the 70 are a result of the YUI utilities.js file which provides the foundation for DED|Chain.
Though I didn’t take advantage of it in my testing, DED provides the developer with the ability to customize interaction with the API. This seems like a nice feature to have as part of the library.
Some of My Favorites
My series of testing documents can be found in the following files:
- Managing Classes
- Animation
- Utility Methods
- Utility Methods (hijackForm)
- Utility Methods (Fetch / Populate)
Throttle (Demo 3)
Throttle allows you to fire off timed requests (once or repeatedly) through an object or array.
_$('#foo2 a').on('click', function(el) {_$().throttle(2, myarray, {id: 'fooneedle',callback: function(needle) {alert(needle);},loop: true // defaults to false});}, true);
And to stop the throttle:
_$('#foo3 a').on('click', function(el) {_$().stopThrottle(’fooneedle’);}, true);
Repeat (Demo 3)
Repeat allows you to fire off requests (repetition of some action) at a given interval of time.
_$('#foo4 a').on('click', function(el) {_$().repeat(5,'repeatme',function() {alert("still repeating");});}, true);
And to stop the repeat:
_$('#foo5 a').on('click', function(el) {_$().stopRepeat(’repeatme’);}, true);
I seemed to have issues with stopping my repeat in the testing I performed. I did post a forum topic regarding the issue.
Fetch (Demo 5)
DED|Chains way of doing AJAX, fetch grabs data from a valid URI and allows you to do something with that data. It also allows you to specify before and after callback keys.
_$('#foo a').on('click', function(el) {_$('#content').fetch(’data.php’, {before: function() {_$('#spinner').show();_$('#content').hide();},after: function(resp) {_$('#spinner').hide();this.show();this.setContent(resp);}});}, true);
Populate (Demo 5)
Populate provides and very easy way to populate data from a valid URI to a section of your page.
_$('#foo2 a').on('click', function(el) {_$('#content').populate(’data2.php’);}, true);
A Final Note
In my testing I wrapped most of my tests up in a click event handler. This allowed me to have more control over my testing.
2 Responses
Jason says:
Thank you for taking the time to develop a front end for Y!UI. Your framework provided the push I needed to get my hands further into Y!UI, and I’m grateful for that.
April 17th, 2007 at 12:03 pm






Dustin Diaz says:
Thanks for giving it a run. You’ve provided honest, frank feedback and I’m glad it caught your interest, if at least for a little bit. I will eventually figure out a way to minimize what gets used in the back (eg Y!UI at the moment). Nevertheless, I appreciate your curiosity.
April 17th, 2007 at 11:48 am