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? It's hard to keep coherence, as you note.
If you want properties to go away, then you need to either explicitly
delete the properties (and then you have to be able to tell apart
properties you added from properties the page defined!) or you have to
use a proxy (in ES5 terms).
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!). But name collisions if the
HTML uses a common id= value and the JS wants that for a global var seem
scarily likely.
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?
See http://dev.w3.org/2006/webapi/WebIDL/#NamedPropertiesObject
(which Window uses). There was a bunch of previous discussion about
this at
http://lists.w3.org/Archives/Public/public-script-coord/2012JanMar/0010.html
and following, though it's not clear to me now whether the solution we
decided on allows var to shadow these named props as desired after all...
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?
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss