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

Garrett Smith dhtmlkitchen at gmail.com
Wed Apr 28 14:28:37 PDT 2010


On Wed, Apr 28, 2010 at 2:12 AM, James Graham <jgraham at opera.com> wrote:
> On 04/28/2010 10:27 AM, David Bruant wrote:
>
>> 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.
>
> To be clear the proposals in this thread are pure syntactic sugar; they
> don't allow you do do anything that you can't already do like:
>
> Array.prototype.whatever.call(html_collection, arg1, arg2, ...)
>
> where "whatever" is the array method you are interested in.
>

- and from that you can expect errors in Internet Explorer up to and
including version 8.

> Of course there is nothing wrong with making the syntax more natural if it
> can be done in a suitably web-compatible way. However it seems more sensible
> to do this at a lower level e.g. as part of Web DOM Core. Sadly that spec is
> in need of an editor.
>

The problem that has been well established is that Internet Explorer's
implementation of host object collections or "dhtml collection"[1]
objects is incompatible with JScript implementation of Array generics.

The result of attempting to supply an Internet Explorer "dhtml
collection" to an Array generic method, e.g. "slice", as the `this`
value, results in a jscript runtimer error: "JScript object expected".

IE8:
[].slice.call(document.styleSheets);

Result:
Error: "JScript object expected".

No other 21st century browsers exhibit such problems, to my knowledge.
The problem is with Internet Explorer.

A program cannot safely use such constructs without at least feature
testing with a try-catch.

If Microsoft will release Internet Explorer 9 with "dhtml collections"
implemented as native EcmaScript objects, then your proposal would not
be needed and would only add more complexity to the overly complicated
WebIDL (which should have been scrapped and restarted). The example
would do what is obviously wanted of it and create an array from the
StyleSheetList object.

I am asking for Microsoft to not Internet Explorer 9 with "dhtml
collections" as unwieldy error-throwing objects. I am asking Microsoft
to instead release Internet Explorer 9 with all "dhtml collections"
implemented as native EcmaScript objects.

Travis Leithead and IE Team: Can you release Internet Explorer 9 with
all "dhtml collections" implemented as native EcmaScript objects?

http://msdn.microsoft.com/en-us/library/ms533048%28VS.85%29.aspx



More information about the whatwg mailing list