W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2013

RE: [DOM4] Short and Efficent DOM Traversal

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>
Message-ID: <B4AE8F4E86E26C47AC407D49872F6F9F8786C2CC@BY2PRD0510MB354.namprd05.prod.outlook.com>
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

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

var iterable = document.querySelectorAll("div");

for (var current of iterable) {

for Ojan's.
Received on Sunday, 28 July 2013 02:40:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:03 UTC