Does not Chrome implement DOM2 spec?
Yeah, probably not. I'd guess they at least implement DOM 3, if not a more current version :-)
However, those don't define a getElementsByName
either. So how did they get this? It is actually specified in HTML5 (WHATWG/W3) on the Document
partial interface:
The DOM specification defines a Document interface, which this [HTML5] specification extends significantly […]
And at http://dev.w3.org/html5/spec-LC/dom.html#documents-in-the-dom I found the note
Because the HTMLDocument interface is now obtained using binding-specific casting methods instead of simply being the primary interface of the document object, it is no longer defined as inheriting from Document.
So the specification details of these interfaces are still in progress, and varying. Notice that browsers are not even supposed to export any kind of DocumentPrototype
- the specs do only define interfaces, not the exact EcmaScript binding representation of them. WebIDL does.
So Chrome does follow the newer specs (but still has some HTMLDocument
?), while Firefox implements an older version. However, it only really matters that these methods do exist on every window.document
- not how they got there :-)