ownerDocument 只读特性在 节点 interface returns the top-level document object of the node.

句法

var document = element.ownerDocument;
					

document is the top-level Document object in which all the child nodes are created. If this property is used on a node that is itself a document, the value is null .

范例

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

规范

规范 状态 注释
DOM
The definition of 'Node: ownerDocument' in that specification.
实时标准

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
ownerDocument Chrome Yes Edge 12 Firefox Yes
Yes
9
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() 被调用。
IE 9 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes
Yes
9
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() 被调用。
Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持

完整支持

见实现注意事项。

元数据

  • 最后修改: