Try this code in FireFox.
You will find that the <span> elements can't be found by the Javascript code.
But it will work in IE.
But when I use a <div> element the <span> elements are found easily by both browsers.
And no, I don't know why the <code> element acts that way. I just know it does.
I would assume it has something to do with the Javascript interpreter that is being used for each browser.
Not all Javascript interpreters are the same from browser to browser.
It could also be that the <code> element is a lower order element like the <b>, <i> and <u> elements.
While the <div> element is a higher order element.
I guess it's kinda like putting a <div> element inside a <span> element.
Though it will probably work in some browsers, it is pragmatically incorrect.