🔰.tagName vs .nodeName

#document-fragment

object

nodeName

tagName

localName

toString()

<B>

B

B

b

HTMLElement

<div>

DIV

DIV

div

HTMLDivElement

shadow root

#document-fragment

ShadowRoot

<custom-element>

CUSTOM-ELEMENT

CUSTOM-ELEMENT

custom-element

HTMLElement

<body>

BODY

BODY

body

HTMLBodyElement

<html>

HTML

HTML

html

HTMLHtmlElement

document

#document

HTMLDocument

window

Window

  • ❌ means "undefined"

Last updated