[whatwg] Adding ECMAScript 5 array extras to HTMLCollection (ATTN IE TEAM - TRAVIS LEITHEAD)

David Bruant bruant at enseirb-matmeca.fr
Wed Apr 28 01:27:04 PDT 2010

Le 28/04/2010 00:03, Garrett Smith a écrit :
> On Mon, Apr 26, 2010 at 10:04 AM, David Flanagan
> <david at davidflanagan.com>  wrote:
>> Erik Arvidsson wrote:
> [snip]
>> Rather that trying to make DOM collections feel like arrays, how about just
>> giving them a toArray() method?  This makes it clear that a collection is
>> not an array, but clearly defines a way to obtain an array.  Clever
>> implementors might even be able to optimize common uses-cases using some
>> kind of copy-on-write strategy so that toArray() doesn't involve memory
>> allocation and copying.
> That would solve the OP's problem, but what about other collections
> like NodeList, StyleSheetList, and CSSStyleDeclaration?
I am sorry, I don't know what "OP" stands for.

> An interface that has a toArray() method might be more suitable, as it
> could be added arbitrarily to other interfaces mentioned already.
I agree with this idea and proposed something in that direction recently :

> In any case, the problem is not going to go away in IE6. Nor IE7. Nor
> IE8. IE9 might change to implement Host object collections as native
> ECMAScript objects, but even then, then the problems will still need
> to be addressed in all versions of IE prior.
In this case, what do you refer as "the problem" ?

When I started this thread, my point was to define a normalized way 
(through ECMAScript binding) to add array extras to array-like objects 
in the scope of HTML5 (HTMLCollection and inheriting interfaces).
I don't see any reason yet to try to find a solution to problems that 
are in current web browsers.
Of course, if/when a proposal emerges from this thread and some user 
agent accept to implement it, a workaround (probably, feature detection) 
will have to be found to use the feature in user agents that implement 
it and doing something equivalent in web browsers that don't.

> MSIE's implementation of Host objects WRT Array generics is a
> fundamental and significant and important problem that needs to be
> addressed.
> If Internet Explorer's problems with Host objects cannot be fixed,
> then it would be a nice feature to have a way to get an array from a
> collection.
The idea of getting an Array from a collection came out without IE in mind.
If we want to have it in a specification, it has to be a good idea 
regardless browsers specificities.

> However, Microsoft should release an IE9 where host object collections
> are implemented as native ECMAscript objects. If they can do that, the
> problems would not be an issue.
> What do you say, Travis Leithead and IE Team? Will you release IE9
> with host object implemented as native EcmaScript objects?
I have not seen any Travis Leithead or IE Team in the recipients. Is 
that normal ?


More information about the whatwg mailing list