W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2014

Re: [WebIDL] Remove ArrayClass?

From: David Bruant <bruant.d@gmail.com>
Date: Sun, 20 Jul 2014 01:05:07 +0200
Message-ID: <53CAF9A3.3080803@gmail.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>, Dirk Schulze <dschulze@adobe.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>, Erik Arvidsson <arv@chromium.org>
Le 19/07/2014 18:01, Boris Zbarsky a écrit :
> On 7/19/14, 9:23 AM, Dirk Schulze wrote:
>> Maybe this is enough and just needs to be evangelist?
> Enough for what?  I mean, it's possible to write:
>   Array.from(document.querySelectorAll("whatever")).map(someFunc)
> today in Firefox, but no other browser seems to support it so far.
Easily polyfilled, though

ES6 also has nice syntax to make an array:
(but that's syntax, so hard to polyfill, requires a transpiler of sort)

> It's possible to do:
>   Array.prototype.slice.
>         call(document.querySelectorAll("whatever")).map(someFunc)
> in all browsers, but the first reaction people have when they see that 
> is "WAT?".  Can't say I blame them.  With ArrayClass that becomes:
>   document.querySelectorAll("whatever").map(someFunc)
> which is what people want out of this stuff anyway.
Another option, which is the one I'll be using increasingly, is to do
     HTMLCollection.prototype._map = Array.prototype.map
then, one can do:

Close enough as far as I'm concerned and hopefully not stepping on 
future standards toes.

Received on Saturday, 19 July 2014 23:05:38 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC