W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2012

Re: "var" declarations shadowing properties from Window.prototype

From: Brendan Eich <brendan@mozilla.com>
Date: Wed, 15 Aug 2012 12:08:47 -0700
Message-ID: <502BF3BF.5060107@mozilla.com>
To: Travis Leithead <travis.leithead@microsoft.com>
CC: Cameron McCormack <cam@mcc.id.au>, Allen Wirfs-Brock <allen@wirfs-brock.com>, Boris Zbarsky <bzbarsky@mit.edu>, "public-script-coord@w3.org" <public-script-coord@w3.org>, "es-discuss@mozilla.org" <es-discuss@mozilla.org>
Travis Leithead wrote:
>> From: Cameron McCormack [mailto:cam@mcc.id.au]
>>
>> Brendan Eich:
>>> As noted, they started out that way 17 years ago. I think WebIDL and
>>> interface-based method definition made onload, e.g., predefined on
>>> window objects, or more recently on Window.prototype. Was this useful?
>>> Was it intended specifically (for window, not just intended generally
>>> due to WebIDL's uniform rules for binding its definitions in JS)?
>> I don't think it provides any benefit.  Uniformity is the only reason the spec
>> says they should be there, currently.
>
> It does provide the monkey-patch benefit for "shared" interfaces (e.g., those shared by inheritance). At the present time, the only one I can think of that [will] act like this is EventTarget (IE10 hasn't yet implemented this hierarchy change).

Do you think it's worth another exception (to the exception whereby 
inherited properties are flattened to be "own" on the global) that adds 
EventTarget.prototype to window objects' prototype chains? Presumably in 
front of (closer to the head of the global object itself) the GSP.

/be
Received on Wednesday, 15 August 2012 19:09:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:07 UTC