"var" declarations shadowing properties from Window.prototype
brendan at mozilla.com
Thu Aug 16 14:39:37 PDT 2012
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?
More information about the es-discuss