All cars are vehicles, but not all vehicles are cars. All thumbs are fingers, but not all fingers are thumbs. All Jacuzzis are hot tubs, but not all hot tubs are Jacuzzis. In the same vein, all HTML elements are nodes, but not all nodes are HTML elements.
Element interface inherits from the
Everything available to the
Node interface is also available to the
Element interface, but this doesn't work both ways.
I higlighted this recently when I wrote about the difference between the
nodeName property considers all types of node, whereas the
tagName property only considers
This is because some types of node, like
Text, are not real HTML elements. This means they don't have a tag name.
But they're still types of node.
tagName properties will be
nodeName properties will be