ownerDocument

calendar March 10, 2010

Value: Document object reference

Compatibility: WinIE6+, MacIE5+, Moz1+, Safari1+

The ownerDocument property belongs to any element or node in the W3C DOM. The property’s value is a reference to the document node that ultimately contains the element or node. If a script encounters a reference to an element or node, the object’s ownerDocument property provides a way to build references to other objects in the same document or to access properties and methods of the document objects.

Example:

document.body.childNodes[5].ownerDocument

The result is a reference to the document object. You can use that to inspect a property of the document,

document.body.childNodes[5].ownerDocument.URL

This returns the document.URL property for the document that owns the child node.

Related Item: document object.

admin

Leave a Reply

You must be logged in to post a comment.