perhaps, but in general I don't write a lot of conditionals like this and I don't mind being explicit. If I were to use something like this I wouldn't make it about classes but, rather, anything. window.has('foo.bar') or something...
On Tue, Apr 28, 2009 at 2:55 PM, nwhite (via Nabble) < ml-user+93763-1341009...@n2.nabble.com<ml-user%2b93763-1341009...@n2.nabble.com> > wrote: > is there any issue with the $classExists function above? > > it seems to me it would be a little less verbose in some cases and clearer > to understand. for example if I want to test for Request.JSONP > > if(!!window.Request && !!window.Request.JSONP ) // do something > > instead becomes: > > if($classExists('Request.JSONP') // do something > > On Tue, Apr 28, 2009 at 2:47 PM, nutron > <anut...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2737207&i=0> > > wrote: > >> there's no point in doing this inside a conditional. ! and !! perform >> coercion, as does the conditional. >> >> >> On Tue, Apr 28, 2009 at 2:38 PM, Sanford Whiteman [Mobile] (via Nabble) < >> ml-user%2b64022-1734430...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2737159&i=0> >> > wrote: >> >>> >>> > Am I missing something or does this seem to be counter intuitive? >>> >>> if (!!window.myClass) ... >>> >>> !! coerces the the value to real boolean, which I like better than >>> leaving it falsy/truthy. >>> >>> --Sandy >>> >>> >> The MooTools Tutorial: www.mootorial.com Clientcide: www.clientcide.com >> >> ------------------------------ >> View this message in context: Re: [Moo] Re: question about >> $defined<http://n2.nabble.com/-Moo--question-about-%24defined-tp2736644p2737159.html> >> Sent from the MooTools Users mailing list >> archive<http://n2.nabble.com/MooTools-Users-f660466.html>at Nabble.com. >> > > > > ------------------------------ > View message @ > http://n2.nabble.com/-Moo--question-about-%24defined-tp2736644p2737207.html > To start a new topic under MooTools Users, email > ml-node+660466-1583815...@n2.nabble.com<ml-node%2b660466-1583815...@n2.nabble.com> > To unsubscribe from MooTools Users, click here< (link removed) >. > > > ----- The MooTools Tutorial: http://www.mootorial.com www.mootorial.com Clientcide: http://www.clientcide.com www.clientcide.com -- View this message in context: http://n2.nabble.com/-Moo--question-about-%24defined-tp2736644p2737486.html Sent from the MooTools Users mailing list archive at Nabble.com.