Is Element.tagName always uppercase?

前端 未结 5 1978
醉酒成梦
醉酒成梦 2020-12-29 19:13

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

5条回答
  •  爱一瞬间的悲伤
    2020-12-29 19:21

    In WebKit/Chromium it is not trustable, WebKit can create tagName properties also in lowercase, most of web pages builds uppercase tagName's, but it is also possible to build lowercase values, so if you use WebKit you must be prepare to support both cases. I thought tagName's are allways uppercase(most of are) and I see I was wrong, now I must little fix my script :)

    chrome's inspector screenshot here

    EDIT: console.log

提交回复
热议问题