Delan Azabani
Delan Azabani

Reputation: 81482

Nodes and Elements in the DOM

Why are Element objects a subclass of Node objects? Aren't elements and nodes the same thing, with different names? Or are there other kinds of Node?

Upvotes: 2

Views: 156

Answers (1)

Anon.
Anon.

Reputation: 60033

Elements are not the only node type.

  • Element nodes are nodes that contain other nodes.

  • Text nodes are nodes that contain text.

  • Attribute nodes are nodes that contain attributes.

Upvotes: 4

Related Questions