Re: variable declarations shadowing named properties on window

On 1/4/12 3:00 PM, Travis Leithead wrote:
>> Agreed on proto chain.  Per spec, var should not look at the proto chain
>> before defining the property on the global.
>
> In that case, Chrome/Safari are clearly wrong according to my test. But that's beside the point.

Yeah, they are.  There were some spec changes here a while back; they 
may not have updated to those yet.

> Let me make sure that I understand you use of "GSP". There are pre-defined properties (as described in the "interface Window" per HTML5). Those are included in the window's prototype chain (not on the window instance/global itself.

Yes, agreed.

> Then there are "dynamic" properties which in IE include frame names, frame indexes, and elements with id, etc. I assume by GSP that you refer to the latter.

Yes.  Though in Gecko there's a difference in behavior between frame 
names and elements with id.  The former live on the window host object 
(not a proxy; it doesn't actually have proxy-like behavior).  The latter 
live on a host object that sits on the prototype chain of the window, 
not on the window itself.

> IE's GSP is tied to the proxy object around the window instance/global object -- it's not in the prototype chain. Think of IE's GSP as a look-aside object of the window instance.

That makes sense for access via window.somename.

But for a bareword somename, is there a proxy involved in IE?

That is, is the ES global in IE actually a proxy and not a "native" object?

It really sounds like the behavior IE has here is not actually 
describable in terms of the ES spec (even with proxies, if I understand 
it correctly) as things stand...

-Boris

Received on Wednesday, 4 January 2012 20:12:38 UTC