Reading at MDN about Element.tagName it states:
On HTML elements in DOM trees flagged as HTML documents, tagName returns the element name in the upper
tagName
and nodeName
comes in lowercase or case sensitive, in case page response headers is having Content-type: application/xhtml+xml;
header or any xhtml related content type.
e.g. document.documentElement.nodeName
returns html
Read this for more cases: https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-745549614