[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

And Clover and-py at doxdesk.com
Mon Aug 2 07:36:46 PDT 2010


On 07/30/2010 06:43 AM, Oliver Hunt wrote:
> all array functions defined in ES5 are "generic" in that they work
> over any array-like object.

They're guaranteed to work over any array-like native JavaScript object. 
They're *not* guaranteed to work on host objects like the various node 
lists.

FWIW in practice `Array.prototype.*.call(htmlcollection)` does work on 
the modern desktop browsers except for IE.

It would be possible to specify that the native-JS object guarantee 
should also extend to node lists. This would allow fast browser 
implementations of the array-like methods to be used without having to 
copy to a new Array. However this would still leave the method of 
calling them a little ugly.

-- 
And Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/



More information about the whatwg mailing list