So could I do $defined(window.Drag) and get the result I wanted? If
that's so, then what's the better way to do this? if I can test just
by doing

if (window.Drag) {}

then what's the point of $defined?

I think I'm missing something here......

Thanks for all the help,
jonlb

On Apr 28, 2:00 pm, nutron <anut...@gmail.com> wrote:
> if (window.Drag) {... drag exists...}
> if (window.Drag && Drag.Move) { ... Drag.Move exists ... }
>
> On Tue, Apr 28, 2009 at 1:57 PM, jonlb (via Nabble) <
> ml-user+57835-2049679...@n2.nabble.com<ml-user%2b57835-2049679...@n2.nabble.com>
>
>
>
> > wrote:
>
> > So, just to be sure I understand....  If I want to be able to check
> > for the presence of the Drag mootools-more class (say to see if it was
> > included or not for optional functionality), I can't just do $defined
> > (Drag). I would need to use the typeof operator instead.
>
> > So by extension, that would go for any class (even my own custom
> > ones).  Correct?
>
> > Thanks,
> > jonlb
>
> > On Apr 28, 1:44 pm, Fábio Costa 
> > <fabiomco...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2736868&i=0>>
> > wrote:
>
> > > anyFunction(undefinedValue) will always throw you an error. You can't
> > pass a
> > > non defined param to a function.
>
> > > For this to work you should declare the var before using the function, in
>
> > > this case:
>
> > > var undefinedValue;
> > > anyFunction(undefinedValue);
>
> > > Will work.
>
> > > In you case:
>
> > > var Drag;
> > > $defined(Drag);
>
> > > Will return false.
>
> > > Fábio Miranda Costa
> > > Engenheiro de Computaçãohttp://meiocodigo.com
>
> > > On Tue, Apr 28, 2009 at 5:26 PM, jonlb 
> > > <jo...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2736868&i=1>>
> > wrote:
>
> > > > Hello All,
>
> > > > I was wondering why it is that if I try to check if a class is defined
> > > > by doing, for instance, $defined(Drag) it will through an error if
> > > > Drag wasn't available. I would expect a false rather than an error.
>
> > > > Am I missing something or does this seem to be counter intuitive?
>
> > > > Thanks,
> > > > jonlb
>
> > ------------------------------
> >  View message @
> >http://n2.nabble.com/-Moo--question-about-%24defined-tp2736644p273686...
> > 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.comwww.mootorial.com
> Clientcide:  http://www.clientcide.comwww.clientcide.com
> --
> View this message in 
> context:http://n2.nabble.com/-Moo--question-about-%24defined-tp2736644p273688...
> Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to