RE: [DOM4] Short and Efficent DOM Traversal

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