- From: David Bruant <bruant.d@gmail.com>
- Date: Sat, 04 Jan 2014 19:17:02 +0100
- 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. Relevant: http://dom.spec.whatwg.org/#nodelist http://code.google.com/p/chromium/issues/detail?id=229398 https://bugzilla.mozilla.org/show_bug.cgi?id=869376 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? ;-) David
Received on Saturday, 4 January 2014 18:17:31 UTC