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: Thu, 16 Aug 2012 14:39:37 -0700
Message-ID: <502D6899.7080903@mozilla.com>
To: Travis Leithead <travis.leithead@microsoft.com>
CC: Boris Zbarsky <bzbarsky@MIT.EDU>, Brandon Benvie <brandon@brandonbenvie.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, "es-discuss@mozilla.org" <es-discuss@mozilla.org>, Jonas Sicking <jonas@sicking.cc>
Travis Leithead wrote:
> I still have my doubts about the magnitude of this problem,

Which problem? Clearly not all stable browsers have rolled out the ES5.1 
erratum fix whereby var ignores the prototype chain. Also clearly, 
WebKit-based browsers bind attribiutes as "own" properties. We won't 
know unless and and until all browsers take the heat we're taking.

Not sure you're taking this heat yet either!

Furthermore, independent of this issue, I raised the (in hindsight 
untenable) injection of readonly attributes onto the global object or 
its prototype chain. This is just bad for backward compatibility on 
principle, and based on 16 years of experience. It's why we have 
[Replaceable]. So I think we should do something along the suggested 
lines (making that the default).

> but if I'm wrong then I'd at least like to be able to grandfather-in some legacy APIs like addEventListener (or other APIs that make sense to have a single shared entry point for easy monkey patching).

Is this a used use-case? There's no grandfathering if WebKit-based 
browsers and Opera have never done it.

Are you guys using EventTarget.prototype.addEventListener = ... to 
affect window's event listening?

/be
Received on Thursday, 16 August 2012 21:40:06 UTC

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