--- title: Node.ownerDocument slug: Web/API/Node/ownerDocument tags: - DOM - Gecko - Node translation_of: Web/API/Node/ownerDocument ---
ownerDocument プロパティは、指定ノードを内包するノードツリーのトップレベルのドキュメントオブジェクトを返します。
document = element.ownerDocument
document : 指定要素の祖先である {{domxref("document")}} オブジェクトvar doc = p.ownerDocument; // ノード p のノードツリー上のトップレベル document オブジェクトを取得 var html = doc.documentElement; // owner のドキュメント要素を取得 alert(html); // [object HTMLHtmlElement]
このプロパティによって返される document オブジェクトは、実際の HTML 文書中ですべての子ノードの属するメインオブジェクトです。document ノード自身に対しこのプロパティを用いた場合、戻り値は null となります。
| Specification | Status | Comment |
|---|---|---|
| {{SpecName("DOM4", "#dom-node-ownerdocument", "Node.ownerDocument")}} | {{Spec2("DOM4")}} | |
| {{SpecName("DOM3 Core", "core.html#node-ownerDoc", "Node.ownerDocument")}} | {{Spec2("DOM3 Core")}} | No change |
| {{SpecName("DOM2 Core", "core.html#node-ownerDoc", "Node.ownerDocument")}} | {{Spec2("DOM2 Core")}} | Initial definition |
{{Compat("api.Node.ownerDocument")}}