Reverted getElementsByTagName() now matches localName instead of tagName

Published: | Categories: DOM


The Document.getElementsByTagName and Element.getElementsByTagName methods are now matching the localName property of nodes instead of the tagName property, as per the latest spec.

This change affects nodes with an XML namespace prefix, such as <svg:circle>. In this case, getElementsByTagName('svg:circle') no longer matches the node and getElementsByTagName('circle') can be used instead. However, the getElementsByTagNameNS method is more formal and recommended, therefore it could be replaced with getElementsByTagNameNS('', 'circle').

Apparently the configuration page of some HP printers is broken due to this change.

Update: This change has been reverted to avoid breaking the HP printer configuration page. The DOM spec will be changed to match tagName as before.