[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

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/

Received on Monday, 2 August 2010 07:36:46 UTC