>
>
> window.has('foo.bar') or something...
>

ah I like that.

Window.implement({
has : function(prop){
var parts = prop.split('.'), obj = window;
for(var i = 0; i < parts.length; i++){
obj = obj[parts[i]];
if(obj == undefined) return false;
}
return true;
}
});





>
>
> On Tue, Apr 28, 2009 at 2:55 PM, nwhite (via Nabble) <
> ml-user%2b93763-1341009...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2737486&i=0>
> > 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.
>>>
>>
>>
> 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-tp2736644p2737486.html>
> Sent from the MooTools Users mailing list 
> archive<http://n2.nabble.com/MooTools-Users-f660466.html>at Nabble.com.
>

Reply via email to