W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: Global variables and id lookup for elements

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Wed, 20 Jul 2011 09:13:24 -0700
Message-ID: <CABZUbM3VUFxyccsf=0d-XjvMXBiJ2dqBRWFeUyMjo+b==Crnpw@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>, Magnus Kristiansen <magnusrk+w3c@pvv.org>, Boris Zbarsky <bzbarsky@mit.edu>, public-webapps@w3.org
On 7/19/11, Cameron McCormack <cam@mcc.id.au> wrote:
> Ian Hickson:
>> Is this still something I should do, or did this get resolved using
>> another solution?
>
> http://www.w3.org/Bugs/Public/show_bug.cgi?id=8241
>
> 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']` ===
window['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:

| ({}).toString.call(window.__proto__.__proto__)

"[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.
-- 
Garrett
Received on Wednesday, 20 July 2011 16:13:55 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:46 GMT