Re: [WebIDL] Remove ArrayClass?

On Jul 19, 2014, at 3:18 AM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:

> On 7/18/14, 5:21 PM, Dirk Schulze wrote:
>> So far ArrayClass was just proposed for the legacy interface DOMRectList recently. In Gecko, ArrayClass is used for MediaLink
> You mean MediaList.  Like the cssom spec says.

Yes of course, a typo. Sorry. Anyway, MediaList and DOMRectList (ClientRectList) are both not implemented in browsers other than Gecko/Servo. Authors can not rely on ArrayClass here anyway today. Removing ArrayClass will unlikely break content.

> And we've had repeated requests to do it for NodeList as well.  I plan to do it soon if I don't run into compat issues (which I don't expect to).

It looks like WebKit has some experience with that already. The popular Closure library broke and many Google projects like Gmail broke with it. While Closure and Gmail have been fixed, there is no guarantee that other projects won’t have the same problem. (instanceof Array checks IIRC). The performance regressions we saw might be implementation specific though. [1]

HTMLCollections might have problems as well with ArrayClass[2].

>> It seems that most people strongly prefer sequences over ArrayClass.
> Sure.  ArrayClass is only useful for legacy listlike interfaces.  And then only for the ones without named getters.  But we should still make those suck less than they do now.

NodeList is a strong candidate for ArrayClass, yes. It just seems like there is a lot of risk that we break content. Closure was for sure just the tip of the iceberg. Legacy APIs that could use it are probably around for too long. Maybe we can find alternative solutions like Array wrappers that must be called by authors explicitly: ArrayWrapper(getClientRects()).


> -Boris


Received on Saturday, 19 July 2014 11:55:56 UTC