Re: Global variables and id lookup for elements

On 7/19/11, Cameron McCormack <> wrote:
> Ian Hickson:
>> Is this still something I should do, or did this get resolved using
>> another solution?
> The proposed solution I made in the bug was to have the [[Get]] etc.
> internal methods of Window handle the resolution order of window named
> properties, rather than to use inheritance in the IDL to control the
> order.  I made that change to Web IDL, which would require you defining
> which named properties are “resolved before prototype properties”, and
> that’d be the frame names; the (possible quirks mode only) ID lookups
> would be done last automatically, since Window isn’t [OverrideBuiltins].
That's different than the way Gecko does it, though.

In Gecko, window.frames === window, and so `window.frames['F']` ===

However element IDs that are resolved off window are resolved off a
special object off window's prototype chain "[object Global Scope
Polluter]". GlobalScopePolluter is on window's prototype's prototype:

| ({})

"[object Global Scope Polluter]"

It is worth mentioning that window's prototype chain includes
GlobalScopePolluter both in quirks and in standards mode. When in
standards mode, element IDs are not resolved and in quirks mode, they
are resolved, but a script warning is issued.

I don't know if anybody cares about the details of this, but if it is
going to be standardized, then it is worth considering how various
browsers handle this legacy feature.

Received on Wednesday, 20 July 2011 16:13:55 UTC