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
My tests show that the tagName
of SVG elements seems to be lowercase in all browsers I checked in August 2018 (Chrome 68, Firefox 61, Edge 42, IE11)
Not sure how that relates to the "DOM trees" mentioned in the MDN docs - maybe SVG trees are handled separately/differently despite of them being part of the DOM tree. In the end, developers do typically speak of "SVG elements" and "DOM elements", as in pointing out that they're not the same thing.
In any case, if your application needs to handle SVG elements as well as regular DOM elements, make sure to use tagName.toUpperCase()
.