- From: Dirk Schulze <dschulze@adobe.com>
- Date: Sat, 19 Jul 2014 22:01:23 +0000
- To: Tab Atkins Jr. <jackalmage@gmail.com>
- CC: Boris Zbarsky <bzbarsky@mit.edu>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Erik Arvidsson <arv@chromium.org>
On Jul 19, 2014, at 11:46 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > On Sat, Jul 19, 2014 at 9:01 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote: >> 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. > > As far as I know, the plan is still to do [ArrayClass] for the results > of el.queryAll(), regardless of whether .qSA() has compat problems. > You just gave basically the entire reason - the existing "slice it > like an array" hack is *total bullshit*, and everyone hates it. > > (I add a "function queryAll(sel) { return > Array.prototype.slice.call(document.querySelectorAll(sel)); }" to my > doc any time I'm doing any DOM manipulation, because I hate it so > bad.) It would be frustrating for authors to have querySelectorAll return a NodeList with Array prototype but let getElementsBy* return an HTMLCollection without Array capabilities. After all, getElementsBy* is and will be used a lot. getElementsBy* and querySelectorAll might have the same backwards compatibility issues if we just make them prototype Array. But for both it would be great to have array capabilities with full backwards compatibility to the previous behavior including prototyping. Greetings, Dirk > > ~TJ
Received on Saturday, 19 July 2014 22:02:09 UTC