W3cubDocs

/DOM

Node.ownerDocument

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

Syntax

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

Example

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

var d = p.ownerDocument; 
var html = d.documentElement;

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.

Specifications

Specification Status Comment
DOM
The definition of 'Node: ownerDocument' in that specification.
Living Standard

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes 12 Yes
Yes
9
The ownerDocument of doctype nodes (that is, nodes for which Node.nodeType is Node.DOCUMENT_TYPE_NODE or 10) is no longer null. Instead, the ownerDocument is the document on which document.implementation.createDocumentType() was called.
6
6
See MSDN.
Yes ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes Yes
Yes
9
The ownerDocument of doctype nodes (that is, nodes for which Node.nodeType is Node.DOCUMENT_TYPE_NODE or 10) is no longer null. Instead, the ownerDocument is the document on which document.implementation.createDocumentType() was called.
Yes ? Yes

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument