In the past and with most my current projects I tend to use a for loop like this:
var elements = document.getElementsByTagName(\'div\'); for (var i=0; i
I like to use a TreeWalker if the set of elements are children of a root node.