Node.ownerDocument (Property)

The document that the node belongs to can be accessed via this property.


DOM level - 1
JavaScript - 1.5
JScript - 5.0
Internet Explorer - 5.0
Netscape - 6.0
Property/method value type:Document object
JavaScript syntax:-myNode.ownerDocument

The Node.ownerDocument property is similar to the document property of an Element object. In this case, because we are considering only DOM nodes, whether the document is HTML or not is of no consequence. For now it probably is because the work centers around browser capabilities but the DOM specification is far more than just a better way to describe a web page.

They have very cleverly separated the description of an abstract document and the 'HTMLness' of it into two layers. That way, implementors can superimpose other types of document content on top of a generic DOM foundation built on the Node structure.

This property is effectively provided by MSIE version 5 as a property of an Element object. Netscape 6.0 makes it available here in a more DOM-compliant manner.

It is a convenience property because accessing a containing document object in this way is far easier than walking down a document.childNode sequence to locate a contained document.

See also:Document object, Element.ownerDocument