This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 11195 - HTMLCollection wants to be an array
Summary: HTMLCollection wants to be an array
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2010-11-02 02:01 UTC by Ian 'Hixie' Hickson
Modified: 2012-11-29 15:38 UTC (History)
7 users (show)

See Also:


Description Ian 'Hixie' Hickson 2010-11-02 02:01:23 UTC
I keep getting people ask me if we can make HTMLCollection (and other such interfaces, like NodeList, FileList, etc) into something akin to JS Arrays, with .forEach, etc. Would be nice if WebIDL had a generic solution to this.
Comment 1 Cameron McCormack 2011-06-17 06:25:53 UTC
Is all that is needed here to make the prototype of HTMLCollection.prototype etc. be Array.prototype?  If so, we could just have an extended attribute [ArrayLike] to require this.
Comment 2 Cameron McCormack 2011-06-20 02:39:25 UTC
Deferring this.
Comment 3 Arthur Barstow 2011-06-29 16:04:57 UTC
Cameron - given what you say in Comment #2, should this now be Resolved as "Later"?
Comment 4 Anne 2012-11-29 15:38:42 UTC
This is [ArrayClass] and NodeList uses it (HTMLCollection cannot because of compatibility; might have to be removed from NodeList too for the same reason...).