Re: DOM collections index out of bounds and JavaScript.

Erik Arvidsson:
> The problem is that trying to get a non existing property in JS should
> return undefined. Not null and not an empty string. I understand that
> the spec used null since Java does not have undefined. 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.

Does it particularly matter that collection.item(999) returns null while
collection['999'] evaluates to undefined?  To me, it makes sense enough.
Functions and properties that returns Nodes, and which have no Node to
return, return null.  I think for consistency with all of these other
funtions and properties, it is preferable to return null from
collection.item().  That’s a much bigger (better) consistency to strive
for than one between collection.item(999) and collection['999'], IMO.

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Tuesday, 19 October 2010 01:12:02 UTC