I'm making a bookmarklet, but I've encountered some wierd behaviour in IE8. The code causing the problem is this:
var els = document.getElementById("my_id").getElementsByTagName("*");
for(var i in els)
{
alert(i+","+els[i])
}
The first thing that is alerted is "length, n". This isn't the case in chrome: just in IE8.
Interestingly, it seems to behave differently depending on whether the code goes in the console/address bar or the page itself.
Is this standard behaviour?
EDIT:
Not down to the website that I run it on either. Is it possible that getElementsByTagName
returns an array with a "length"
key set in IE? It certainly doesn't return a pure array.