- From: Keith Cirkel <notifications@github.com>
- Date: Sat, 17 Jun 2023 03:07:01 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 17 June 2023 10:07:07 UTC
Now that [the “iterator helpers” proposal](https://github.com/tc39/proposal-iterator-helpers) is Stage 3 and [browsers are intending to ship it](https://groups.google.com/a/chromium.org/g/blink-dev/c/UyzwOm9QrxI/m/Ic40zdYYDAAJ), perhaps it’s a good time to investigate how we can make these ergonomic for DOM collection APIs like NodeList. Currently NodeList can be coerced to an iterator, which means it will be possible to do `document.querySelectorAll('.foo')[Symbol.iterator]().take(5)` however this isn’t exactly in the top 10 list of elegant APIs. I propose we expend some energy to see if it’s web compat to add iterator helper method aliases to NodeList proper, so that developers can use the much more pleasant `document.querySelectorAll('.foo').take(5)`. The following method names are part of iterator helpers: - `.map` - `.filter` - `.take` - `.drop` - `.flatMap` - `.reduce` - `.toArray` - `.forEach` (already on NodeList) - `.some` - `.every` - `.find` -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1211 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1211@github.com>
Received on Saturday, 17 June 2023 10:07:07 UTC