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

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

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Wed, 28 Apr 2010 00:03:33 -0700
Message-ID: <v2jc9e12661004280003qb45a8ca9y7b0e6d034218ca5e@mail.gmail.com>
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?

An interface that has a toArray() method might be more suitable, as it
could be added arbitrarily to other interfaces mentioned already.

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.

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.

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?

Garrett
Received on Wednesday, 28 April 2010 00:03:33 UTC

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