This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

ownerDocument

Summary

Retrieves the document object associated with the node.

Property of dom/Nodedom/Node

Syntax

Note: This property is read-only.

var doc = element.ownerDocument;

Return Value

Returns an object of type DOM NodeDOM Node

The document Node of the web page or iframe or frame.

The document object returned by this property is the main object with which all the child nodes in the actual HTML document are created. If this property is used on a node that is itself a document, the result is null.

Examples

// given a node "p", get the top-level HTML child
// of the document object

var doc = p.ownerDocument;
alert(doc.outerHTML);
var html = doc.documentElement;
alert(html.outerHTML);

Usage

 Used to build the DOM tree of documents that contain <iframe>, <frame> and <frameset> elements.

Notes

Remarks

The ownerDocument is the Document object that is used to create new nodes. This property returns null when the node is a Document. ownerDocument was introduced in Microsoft Internet Explorer 6.

Syntax

var doc=element.ownerDocument;

Related specifications

DOM Level 2 Core
Recommendation

Attributions