For HTML documents, and for HTML elements in HTML documents, certain APIs defined in DOM Core become case-insensitive or case-changing, as sometimes defined in DOM Core, and as summarized below. [DOMCORE]
This does not apply to XML documents or to elements that are not in the HTML namespace despite being in HTML documents.
Element.tagName
and Node.nodeName
These attributes return element names converted to ASCII uppercase, regardless of the case with which they were created.
Document.createElement()
The canonical form of HTML markup is all-lowercase; thus, this method will lowercase the argument before creating the requisite element. .
This doesn't apply to Document.createElementNS()
.
Thus, it is possible, by passing this last method a tag name in
the wrong case, to create an element that appears to have the same
tag name as that of an element defined in this specification when
its tagName
attribute is
examined, but that doesn't support the corresponding interfaces.
The "real" element name (unaffected by case conversions) can be
obtained from the localName
attribute.
Element.setAttribute()
Element.setAttributeNode()
Attribute names are converted to ASCII lowercase.
This doesn't apply to Element.setAttributeNS()
and Element.setAttributeNodeNS()
.
Element.getAttribute()
Element.getAttributeNode()
Attribute names are converted to ASCII lowercase.
This doesn't apply to Element.getAttributeNS()
and Element.getAttributeNodeNS()
.
Document.getElementsByTagName()
Element.getElementsByTagName()
HTML elements match by lower-casing the argument before comparison, elements from other namespaces are treated as in XML (case-sensitively).
Thus, in an HTML document with nodes in multiple namespaces, these methods will effectively be both case-sensitive and case-insensitive at the same time.