So the global object is always window?
But why alert(window == this) tells me
false?

David

On 31 Mrz., 15:13, Anton Muhin <[email protected]> wrote:
> On Wed, Mar 30, 2011 at 11:39 PM, David Xanatos
>
> <[email protected]> wrote:
> > Cool, thanks for the answer,
>
> > So this with statement allows me to have inside the called function a
> > "this" made up of multiple objects.
>
> Not quite, it's a special chain of objects which are used to resolve
> identifiers.  http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/
> is a good text about it.
>
> > But, how does it work with alert this is a function of window, but
> > windows is not been point in such with thing ?
>
> alert is defined on the global object (and window is just an alias to
> it), so it's always accessible unless shadowed.
>
> yours,
> anton.
>
>
>
>
>
>
>
>
>
> > David
>
> > On 29 Mrz., 20:43, Anton Muhin <[email protected]> wrote:
> >> David,
>
> >> As per the spec, DOM bindings build a special context chain for that,
> >> seehttp://codesearch.google.com./codesearch/p?hl=en#OAMlx_jo-ck/src/thir...
> >> for more details.
>
> >> hth and yours,
> >> anton.
>
> >> On Tue, Mar 29, 2011 at 10:34 PM, David Xanatos
>
> >> <[email protected]> wrote:
> >> > When I am in a event like onlaod="alert('bla'); this.alert('blup')"
> >> > the this is not longer 'window' but the html object the event is in.
> >> > But strangely I call call any alert and use document as if the global
> >> > object still would be the window, but alert(window == this) tells me
> >> > false :/
>
> >> > I would like to use this behavioure in a V8 C++ project, so i wanted
> >> > to ask how is this "superopsition" of the global object with an other
> >> > object achieved?
>
> >> > --
> >> > v8-users mailing list
> >> > [email protected]
> >> >http://groups.google.com/group/v8-users
>
> > --
> > v8-users mailing list
> > [email protected]
> >http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to