- From: Domenic Denicola <domenic@domenicdenicola.com>
- Date: Sun, 28 Jul 2013 02:40:08 +0000
- To: Ojan Vafai <ojan@chromium.org>, François REMY <francois.remy.dev@outlook.com>
- CC: DOM WG <www-dom@w3.org>, "public-webapps@w3.org" <public-webapps@w3.org>
Both of these seem very like the ES6 iterator interface. Can you just use that instead of minting a new iterable/iterator interface, viz. `.iterator()`/`.next()` or `.nextNode()`? The resulting code would be
```js
var tw = document.createTreeWalker(document.body, "ul.menu > li");
for (var node of tw) {
if (...) break;
...
}
```
for François's proposal, whereas it would be
```js
var iterable = document.querySelectorAll("div");
for (var current of iterable) {
current.remove();
}
```
for Ojan's.
Received on Sunday, 28 July 2013 02:40:51 UTC