On Nov 27, 10:50 pm, seasoup wrote:
> On Nov 27, 7:14 am, RobG wrote:
>> On Nov 27, 11:32 pm, spradeepkumar wrote:
>> [...]
>>> If you are particular in using this...prototype has got
>>> bind methods with which you can control your scope....
>> The value of a function's this keyword has nothing to do
>> with scope, it is set by the call.

> $(selector).each(function(){
>   alert(this);
> }.bind($(somethingElse));
> sets somethingElse as the 'this' inside of the each function,
> instead of the item in the array.  That's what spradeepkumar
> was referring to by controlling scope.

And it was referring to setting the - this - value as "controlling
scope" (or as having anything to do with scope at all) that was being
corrected. Scope is quite an important concept in javascript, indeed
being 'lexically scoped' is one of the defining characteristics of the
language. (With the exception of possible used of the - with -
statement) Scope is defined by the ((lexical) structure of the) source
code and not amenable to runtime modification (or control). The value
of the - this - keyword in a function is determined at runtime by how
the function is called, and can be 'controlled'. It may be
(unfortunately) common to speak of 'scope' when talking about the -
this - keyword but the two are really very different things that
should not be confused.
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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to