The Node.ownerDocument
read-only property returns the top-level document object for this node.
document = element.ownerDocument
document
is the document
object parent of the current element.// given a node "p", get the top-level HTML child // of the document object var d = p.ownerDocument; var html = d.documentElement;
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
.
Specification | Status | Comment |
---|---|---|
DOM The definition of 'Node: ownerDocument' in that specification. | Living Standard |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | 12 | Yes
|
6
|
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 | ? | 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