Is indexing into a NodeList using [] rather than item() completely reliable-cross browser, and (separately) is it documented anywhere? E.g.:
var firstDiv = document.getElementsByTagName('div')[0];
As far as I can tell, the most up-to-date definition of the NodeList interface is here in DOM3, and the most recent documentation of the JavaScript bindings is in the DOM2 version. I’m not seeing anything about indexing into NodeLists via [], but I see people doing it all the time (and I’ve done it myself frequently, but always a bit nervously).
So I tried it out on a bunch of browsers, including IE6, and it works a champ everywhere I tried it (IE6, IE9, Chrome 16, Firefox 10, Firefox 5, Opera 11, Safari 5, Konqueror 4.7, Epiphany 3.0, Midori 0.4). Which is great, except I don’t have dozens of edge-case browsers around.
So I’m looking for input from anyone who’s been down this road before. Is it completely reliable cross-browser, and ideally is it documented anywhere?
From one of your links (my emphasis):
And from another link:
So yes, it is documented. And reliable.