As I’m working on the next edition of Professional JavaScript, I’ve been updating rewriting a large amount of it to include more of the vendor-specific JavaScript extensions. Today I took a look at getElementsByClassName(), which is implemented in Firefox 3 Beta 2 and the latest builds of WebKit.

This method is specified in HTML 5 as returning a NodeList of results. Ugh. Yet another performance cost to yet another DOM method. Groaning aside, it appears that the implementation in Firefox 3 Beta 2 actually returns an Array instead of a NodeList. I did some digging to figure out if maybe they had changed NodeList so that it inherited from Array, but this is not the case. WebKit, on the other hand, does return a NodeList of results.

And just so everyone knows, it looks like Opera 9.5 is also supporting getElementsByClassName(). It also correctly returns a NodeList. Looks Firefox is the only one behind the times on this one, but it is still in beta so hopefully it will be fixed.

Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.