W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2014

Re: [whatwg] NodeList.forEach/map/filter still doesn't work

From: David Bruant <bruant.d@gmail.com>
Date: Sat, 04 Jan 2014 19:17:02 +0100
Message-ID: <52C8501E.1050306@gmail.com>
To: Kornel Lesiński <kornel@geekhood.net>, whatwg <whatwg@whatwg.org>
Le 04/01/2014 16:10, Kornel Lesiński a écrit :
> I don't think anybody cares for NodeList.forEach/map/filter/etc to be 
> "real" Array functions, so I'd love to see even a simplest fix like:
> NodeList.prototype.map = function(...whatever) {
>     return Array.from(this).map(...whatever);
> }
> NodeList.prototype.forEach = function(...whatever) {
>     return Array.from(this).forEach(...whatever);
> }
No need. Array.prototype.forEach&friends are generic on purpose so they 
can be applied to array-likes like NodeList.
Technically, we can have NodeList.prototype.forEach = 
Array.prototype.forEach (or rather Array.prototype in the NodeList 
instances prototype chain as currently speculatively spec'ed)
I imagine the problem if there is one will be a web compatibility one... 
as usual.


Both Firefox and Chrome are already open to experiment it.
I imagine the only thing they need is the engineering time both to 
implement it and keep an eye open on their bug tracker to see if a 
website breaks because of this change, analyse, revert, do some 
evangelism to broken websites, retry, report back to standards for the 
bad news when people doing the experiment get tired of it.

I wish they were spending the time too. Other people would prefer to see 
the implementation of WebComponents prioritized.

How is your C++ and more importantly, what's the amount of time and 
patience you can put on evangelism? ;-)

Received on Saturday, 4 January 2014 18:17:31 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:15 UTC