Re: [Proto-Scripty] Re: how to check is the function = Prototype.emptyFunction ?

2010-02-01 Thread Richard Quadling
On 1 February 2010 15:44, buda  wrote:
> it was simple sheme and it wasnt the stright code
> it must be like this
>
> var Obj = {};
>  ...
> Obj.meth = Prototype.emptyFunction;
>  ...
> if (Obj.meth !== Prototype.emptyFunction) {
>  alert('Not equal');
> }
>
> does this irritates you?
>
> On Feb 1, 5:37 pm, Alex Wallace  wrote:
>> This is getting into dirty territory (or at least I'd feel so) but:
>>
>> >>> var x = function(){};
>> >>> var y = function(){ alert("foo"); }
>> >>> x + "";
>> "function () { }"
>> >>> y + "";
>>
>> "function () { alert("foo"); }"
>>
>> Best,
>> Alex
>>
>>
>>
>> On Mon, Feb 1, 2010 at 10:29 AM, buda  wrote:
>> > the question is: how to check if a function is empty or have any code
>>
>> > On Feb 1, 5:18 pm, Richard Quadling  wrote:
>> > > On 1 February 2010 13:02, buda  wrote:
>>
>> > > > var Obj = {};
>> > > > Obj.meth = Prototype.emptyFunction;
>>
>> > > > if (Obj.meth !== Prototype.emptyFunction) {
>> > > >  alert('Not equal');
>> > > > }
>>
>> > > > why alert show everytime?
>>
>> > > > --
>> > > > You received this message because you are subscribed to the Google
>> > Groups "Prototype & script.aculo.us" group.
>> > > > To post to this group, send email to
>> > prototype-scriptacul...@googlegroups.com.
>> > > > To unsubscribe from this group, send email to
>> > prototype-scriptaculous+unsubscr...@googlegroups.com
>> > .
>> > > > For more options, visit this group athttp://
>> > groups.google.com/group/prototype-scriptaculous?hl=en.
>>
>> > > Why?
>>
>> > > The main advantage of the emptyFunction is that you can always call it
>> > > without having to do a null/undefined test first.
>>
>> > > If you want to know if it has been assigned something, then don't
>> > > assign the emptyFunction, leave it as null and then test if it is
>> > > null.
>>
>> > > --
>> > > -
>> > > Richard Quadling
>> > > "Standing on the shoulders of some very clever giants!"
>> > > EE :http://www.experts-exchange.com/M_248814.html
>> > > EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp
>> > > Zend Certified Engineer :
>> >http://zend.com/zce.php?c=ZEND002498&r=213474731
>> > > ZOPA :http://uk.zopa.com/member/RQuadling-Hide quoted text -
>>
>> > > - Show quoted text -
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Prototype & script.aculo.us" group.
>> > To post to this group, send email to
>> > prototype-scriptacul...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > prototype-scriptaculous+unsubscr...@googlegroups.com
>> > .
>> > For more options, visit this group at
>> >http://groups.google.com/group/prototype-scriptaculous?hl=en.- Hide quoted 
>> >text -
>>
>> - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

Can you try ...

alert((Obj.meth + '') == (Prototype.emptyFunction + ''));

I'm getting True for when Obj.meth is the emptyFunction.



-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: how to check is the function = Prototype.emptyFunction ?

2010-02-01 Thread Alex Wallace
This is getting into dirty territory (or at least I'd feel so) but:

>>> var x = function(){};
>>> var y = function(){ alert("foo"); }
>>> x + "";
"function () { }"
>>> y + "";
"function () { alert("foo"); }"

Best,
Alex

On Mon, Feb 1, 2010 at 10:29 AM, buda  wrote:

> the question is: how to check if a function is empty or have any code
>
> On Feb 1, 5:18 pm, Richard Quadling  wrote:
> > On 1 February 2010 13:02, buda  wrote:
> >
> >
> >
> >
> >
> > > var Obj = {};
> > > Obj.meth = Prototype.emptyFunction;
> >
> > > if (Obj.meth !== Prototype.emptyFunction) {
> > >  alert('Not equal');
> > > }
> >
> > > why alert show everytime?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Prototype & script.aculo.us" group.
> > > To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/prototype-scriptaculous?hl=en.
> >
> > Why?
> >
> > The main advantage of the emptyFunction is that you can always call it
> > without having to do a null/undefined test first.
> >
> > If you want to know if it has been assigned something, then don't
> > assign the emptyFunction, leave it as null and then test if it is
> > null.
> >
> > --
> > -
> > Richard Quadling
> > "Standing on the shoulders of some very clever giants!"
> > EE :http://www.experts-exchange.com/M_248814.html
> > EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp
> > Zend Certified Engineer :
> http://zend.com/zce.php?c=ZEND002498&r=213474731
> > ZOPA :http://uk.zopa.com/member/RQuadling- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.