[dojo-contributors] Prototype-al simplicity

Brian Douglas Skinner skinner at dojotoolkit.org
Mon Apr 10 18:40:22 EDT 2006


Bill Keese wrote:
>>One small thing is to declare all the functions like they are part 
>>of an object (or part of a package?), like this:
>>
>>dojo.style = {
>>        getPixelValue: function() { ... },
>>        getNumericStyle: function() { ... },
>>};

James Burke wrote:
> I personally like that style. It does save some space, but it is 
> a little more error-prone (be sure to test in MSIE to make sure 
> you don't leave a trailing comma after the last property definition). 

That trailing comma problem is one of the things that Douglas 
Crockford's JSLint utility checks for.  On the OpenRecord project, we've 
set up our unit tests to run JSLint on all the code, and we try not to 
ever check in code that doesn't pass the unit tests.  That may seem 
compulsive, but it does defend against some types of bugs that you 
otherwise wouldn't find out about until after you ship.  As Dojo gets 
closer to 1.0 it might be useful to automate more testing.

:o) Brian



More information about the dojo-contributors mailing list