On 10/18/10 8:51 PM, Erik Arvidsson wrote:
When DOM was first spec'ed the collection interfaces all had some kind of item method. These methods sometimes return like null[1] and sometimes other values such as an empty string [2]. The JavaScript bindings for these allows us to use indexed getters instead of calling the item method.
I think in practice this has been a fiction in the edge case you're interested in.
The problem is that trying to get a non existing property in JS should return undefined.
This is what UAs implement, yes (modulo bugs).
Since we are trying to realign these specs with the web it would make sense to try to make them fit better with JavaScript and mandate that the JS bindings for collections should return undefined for getting an item out of bounds.
This has nontrivial compat risks, I suspect. I've seen code that compares the return value of item() to null using ===...
I agree that using the [] notation should return undefined for out-of-bounds stuff; I'm pretty sure the indexgetter stuff already says so.
-Boris