The read-only parentNode
property of the Node
interface returns the parent of the specified node in the DOM tree.
Document
and DocumentFragment
nodes can never have a parent, so parentNode
will always return null
. It also returns null
if the node has just been created and is not yet attached to the tree.