Node: ownerDocument 属性

Baseline 已广泛支持

此特性已相当成熟,可在许多设备和浏览器版本上使用。自 ⁨2015 年 7 月⁩以来,各浏览器均已提供此特性。

Node 接口的只读 ownerDocument 属性返回节点的顶级文档对象。

一个 Document,它是创建所有子节点的顶级对象。

如果此属性用于节点本身是文档的情况,则值为 null

示例

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

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

规范

规范
DOM
# ref-for-dom-node-ownerdocument①

浏览器兼容性