W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

From: And Clover <and-py@doxdesk.com>
Date: Mon, 02 Aug 2010 16:36:46 +0200
Message-ID: <4C56D7FE.7000705@doxdesk.com>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:25 UTC