Using as a benchmark the task of iterating over a live collection produced by getElementsByTagName. IE/Win, Gecko and Safari all agree as to the fastest means:
Using a while loop and storing the live collection in a variable is the quickest technique in all of these browsers.
var i = 0, el, els = document.getElementsByTagName(nodeName); while (el = els[i++]) { // [...] }
Using a while loop and storing the live collection in a variable is the quickest technique in all of these browsers.