var nodes = document.getElementsByTagName('input')This worked fine in Firefox 2 and IE 6. Later I started testing with Safari for Windows and noticed a problem. I tracked it down to this discovery: getElementsByTagName returns different types in Firefox and Safari.
for(i in nodes)
if(nodes[i].className == 'aCertainClass')
; // process checkbox
In Firefox, getElementsByTagName returns an HTMLCollection, which works fine with the iterator style for(i in nodes). In Safari, it returns a NodeList, and iterating with for(i in nodes) takes you on a trip through the object's methods, rather than its collection contents.
The fix for this was to change the iteration style, since both HTMLCollection and NodeList support the length field:
For what it's worth, I've only seen NodeList documented as the expected return type from getElementsByTagName. Why it doesn't work with the for(i in nodes) iteration syntax is something for which I'd like an explanation.
var nodes = document.getElementsByTagName('input')
for(var i=0; i < nodes.length; i++)
// same as before