ok I see that now.  Maybe this is a lesson in anonymous closures I missed,
but I know that the window object is essentially the default global scope,
though the assignment is inside an anonymous closure so I expected the
'this' object to not be the global scope, which as you point out, it is.  It
makes sense now, thanks.



On Thu, Jun 4, 2009 at 12:22 AM, spicyj <spicyjalap...@gmail.com> wrote:

>
> In an ordinary browser window, the default scope of JavaScript code is
> the window, so this refers to the window object. The line
>
> var window = this;
>
> has no purpose except to allow the YUI Compressor to change the
> variable name to save space. Thus, code like this (for example):
>
> var window = this;
> window.scrollTo(0, 120);
>
> can be reduced to
>
> var A = this;
> A.scrollTo(0, 120);
>
> Then, A is a reference to window, and you don't need to spell out the
> entire word "window" each time you want to refer to it.
>
> Hopefully that was clear.
>
> ~spicyj
> >
>


-- 
Christopher Thatcher

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to