Why is "document" node a parent to the "html" node?

  document, html, javascript, parent

I have read on this page (Difference between Node object and Element object?) that "The document node has the html node as its child."

But on this page (Multiple <html><body> </html></body> in same file), it says that you can only use a single "html" node per document because having several html nodes per document will cause the script to malfunction.

How can "document" be a parent to "html" if both of them can occur only once? Shouldn’t they be called "siblings" instead?

According to my understanding, a hierarchical relationship implies that a parent node is a parent node only if it’s a combination of several sub-nodes.

Source: Ask Javascript Questions

LEAVE A COMMENT