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

Geoffrey Sneddon gsneddon at opera.com
Thu Apr 29 06:59:21 PDT 2010


On 28/04/10 23:28, Garrett Smith wrote:
> 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.

Adding a toArray operation (for example) won't work in IE up to and 
including version 8 though either. There's no point in adding a toArray 
operation for the pure reason that they currently don't implement 
another part of the spec (through the WebIDL references) currently. 
toArray adds no extra usefulness once they implement other parts of the 
spec.

>
>> 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".

In IE8 document.styleSheets.toArray().slice(0, 1); also throws an error. 
How does adding toArray help for IE8, which you're giving as the reason 
for adding it?

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

As far as I am aware, none of them are on this list.

-- 
Geoffrey Sneddon — Opera Software
<http://gsnedders.com/>
<http://www.opera.com/>



More information about the whatwg mailing list