Re: Re: [Netwindows-cvs-notify] netWindows/winScripts/widgets validator_widget.js, 1.4, 1.5
Michael Flanagan <[email protected]> Fri, 16 Jan 2004 11:05:48 -0800
| Newsgroups | gmane.comp.windows.devel.netwindows |
|---|---|
| Message-ID | <[email protected]> |
Comments also inline. On 16-Jan-04, at 10:33 AM, Alex Russell wrote: > Comments inline, please fix. > > On Friday 16 January 2004 10:06 am, [email protected] > wrote: >> Update of /cvsroot/netwindows/netWindows/winScripts/widgets >> In directory sc8-pr-cvs1:/tmp/cvs-serv31186/winScripts/widgets >> >> Modified Files: >> validator_widget.js >> Log Message: >> Added .changed() back to the validator widget. It was lost >> somewhere in the rewrite. >> >> Changed 'obj' references back to 'metaObj' for consistency with the >> rest of the validators. If we want to change the name of these, we >> should change them all to 'obj'. >> >> Index: validator_widget.js >> =================================================================== >> RCS file: >> /cvsroot/netwindows/netWindows/winScripts/widgets/validator_widget. >> js,v retrieving revision 1.4 >> retrieving revision 1.5 >> diff -u -w -d -r1.4 -r1.5 >> --- validator_widget.js 6 Jan 2004 19:13:52 -0000 1.4 >> +++ validator_widget.js 16 Jan 2004 18:06:28 -0000 1.5 >> @@ -64,6 +64,13 @@ >> </para> >> <!--*/ >> >> + this.changed = function() { >> + var cmp = __components__.getComponentFromNode( domNode ); >> + if( !cmp || !cmp.validatorType ) return; > > Um, what? > > You know the style Nazi is going to bust a cap in yo ass for this, > don't you? > > Use this: > > if((!cmp)||(!cmp["validatorType"])){ return; } > > NO CONDITIONALS WITHOUT CURLIES!!!!! > > This is non-negotiable, non-optional, and is just going to get you > nastygrams from me. What's life without a nastygram once in a while. In other news, the curlies have been added to the if. >> + >> + domNode.value = cmp.validatorType.apply( domNode.value ); >> + } >> + >> // needs to be implemented by subclass >> this.apply = function(data){ >> return data; >> @@ -240,21 +247,22 @@ >> function NW_VALIDATOR_FACTORY_date(domNode){ >> var attrArr = ['displayFormat', 'dbFormat' ]; >> var props = __util__.parseNWProps(domNode, attrArr); >> - var obj = new NW_VALIDATOR_date(domNode); >> + var metaObj = new NW_VALIDATOR_date(domNode); > > It's internal and private. Who cares what the identifiers is? Shorter > is better if it's not less clear. File size is the enemy here. > > Clarity good. Size bad. > Which is why I put the question in the commit comment. All references have been changed to 'obj'. Syntax for all if statements with multiple arguments has been changed so include brackets around each arg. Since we're about it, the helper Array.prototype functions you recently added to extende_ecam.js has broken some code. I'm working up a seperate email with details on it. For now I've reverted to a previous version for our app. _______________________________________________ The netWindows developers list: [email protected] http://netwindows.org/mailman/listinfo/devel_netwindows.org