Re: [WebIDL] Trying to understand IndexGetter/NameGetter

On 10/8/09 11:52 AM, Boris Zbarsky wrote:
> I think we should fix this. The current setup really doesn't work very
> well... Gecko's ES implementation certainly has a hook that can be used
> by host objects to affect 'in' and enumeration behavior, and is what we
> use for nodelists.

OK, I just went ahead and checked exactly how document.links, at least, 
works using the attached testcase.

Results in Gecko:
1 -- null
http://example.org/ -- http://example.org/
http://example.com/ -- http://example.com/
http://example.org/ -- http://example.org/
http://example.com/ -- http://example.com/
http://example.org/ -- null
undefined -- null
4 -- null
undefined -- null

Results in Safari 4:
1 -- null
http://example.org/ -- http://example.org/
http://example.com/ -- http://example.com/
http://example.org/ -- http://example.org/
http://example.com/ -- http://example.com/
2 -- null
3 -- null
4 -- null
5 -- null

Results in Opera 10:
1 -- null
1 -- http://example.org/
http://example.com/ -- http://example.com/
2 -- http://example.org/
3 -- http://example.com/
2 -- null
3 -- null
4 -- null
5 -- null

Results in Chrome 4:
As Safari 4.

Results in IE8:
1 -- null
http://example.org/ -- http://example.org/
http://example.com/ -- http://example.com/
exception on |l[0] = 2|.

If I take out the 2 and 3 sets, I get, in IE8:
1 -- null
http://example.org/ -- http://example.org/
http://example.com/ -- http://example.com/
http://example.org/ -- http://example.org/
http://example.com/ -- http://example.com/
1 -- null
undefined -- null
4 -- null
5 -- null

Analysis:  Gecko doesn't actually remove the property if the element is 
removed.  This is why you get "undefined -- null" at the very end 
instead of "5 -- null", for example: the property that was added by the 
index access is readonly even after the indexed link is gone.  There's 
also weirdness here involving interaction of slots and getters; I can go 
into detail if desired.

Safari and Chrome seem to keep track of the property sets, but the index 
access shadows those properties, if it returns something.  Note in 
particular the "2 -- null" and "3 -- null" lines.

Opera just has property sets shadow the indexed properties.

IE doesn't allow setting properties while they're shadowed by an index, 
but as soon as the indexed thing goes away it's OK to set them.

Not a lot of interop here, huh?  :(

-Boris

Received on Thursday, 8 October 2009 17:49:11 UTC