- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Sun, 12 Aug 2012 19:22:48 -0400
- To: Brendan Eich <brendan@mozilla.com>
- CC: Brandon Benvie <brandon@brandonbenvie.com>, public-script-coord@w3.org, es-discuss@mozilla.org
On 8/12/12 5:23 PM, Brendan Eich wrote: > Boris Zbarsky wrote: >> On 8/12/12 4:31 PM, Brendan Eich wrote: >>> However, check me here: the GSP makes "own" global properties on demand, >>> when names of DOM elements that come from name= and id= attributes (or >>> just id=? I forget) are used as identifier expressions. >> >> That's what it does in Gecko's impl right now. It has a bunch of >> issues, including the properties not going away when the name or id >> attributes change or the relevant element is removed from the document. > > Did IE4 onward (to modern IE) or any browser that copied name pollution > from IE do that? I believe every non-Gecko browser does this right last I tested. > So long as we take the ES5.1 erratum that's already implemented by most > engines, I suspect the GSP growing its own proto-tier instead of making > global "own" properties on demand is ok. People do not var+obj-detect > elements by name (please confirm or deny!) I would hope not. And again, var shadows the GSP in IE; I can't speak to what WebKit-based browsers do here because I haven't tested it recently. > But name collisions if the > HTML uses a common id= value and the JS wants that for a global var seem > scarily likely. Yes, using the GSP is more or less a recipe for fail. That's why I'd hoped to restrict it to quirks mode pages. Ah, well. >> Per the current spec proposal, the GSP lives on the proto chain and >> exposes the various id/name stuff as own properties on itself, with >> the usual caveats about checking up the proto chain first that DOM >> named access has. > > So that the global window.g created (absent a prior extant own property) > by var g; and var g = i; given <div id='g'>Gee</div> trump the polluting > proto-g? Assuming the erratum to ES 5.1 applies, yes. If it doesn't, then I'm not sure. > I didn't read the whole thread, but I noticed frames came up. They do > historically make "own" global props, I did that in 1995 and I think it > stuck. Is this changing? That's the current plan, I believe. Per current HTML5 spec, frames and ids do exactly the same thing (as in, put properties on the same object, whatever that object is). This doesn't match Gecko, but it may match current IE. -Boris
Received on Sunday, 12 August 2012 23:23:24 UTC