Visit Mozilla.org

DOM:element.ownerDocument

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

The ownerDocument property returns the top-level document object for this node.

[edit] Syntax

document = element.ownerDocument
  • document is the document object parent of the current element.

[edit] Example

// given a node "p", get the top-level HTML child 
// of the document object
d = p.ownerDocument; 
html = d.documentElement;

[edit] Notes

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.

[edit] Specification

ownerDocument