RE: [DOM4] Short and Efficent DOM Traversal

> From: ojan@chromium.org
> 
> An alternate proposal: http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2013-July/040264.html. 
> var iterator = document.querySelectorAll("abc").asIterator();

You make the assumption I want to walk in the forward direction and do not want to start from a specific node. In my case, I want to start from a node and find the next/previous one (in DOM order) that matches some condition, so your solution isn't any useful to me.

Also, the concept of lazy list that doesn't get computed looks slightly weird to me, because qSA/getEB* are static list so they would need to be computed as soon as you make any DOM change, even if it just happens the list only exists in memory because the GC didn't collect it. Honestly, I don't see how that could work, except if calling .iterator() destroys the list (ie: make it empty if it had been computed, remove it from the compute queue otherwise) but this seems fragile to me. 		 	   		  

Received on Sunday, 28 July 2013 02:44:10 UTC