From ed6203f957a5616efa135b87368715645b251444 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sat, 26 Feb 2022 00:16:32 +0900 Subject: 2021/11/08 時点の英語版に同期 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/api/node/ownerdocument/index.md | 68 ++++++++-------------------- 1 file changed, 19 insertions(+), 49 deletions(-) (limited to 'files/ja/web/api/node/ownerdocument') diff --git a/files/ja/web/api/node/ownerdocument/index.md b/files/ja/web/api/node/ownerdocument/index.md index f6eef4f570..75cf471b02 100644 --- a/files/ja/web/api/node/ownerdocument/index.md +++ b/files/ja/web/api/node/ownerdocument/index.md @@ -2,65 +2,35 @@ title: Node.ownerDocument slug: Web/API/Node/ownerDocument tags: - - DOM - - Gecko - - Node + - プロパティ + - リファレンス + - 読み取り専用 +browser-compat: api.Node.ownerDocument translation_of: Web/API/Node/ownerDocument --- -
{{ApiRef}}
+{{APIRef("DOM")}} -

概要

+**`ownerDocument`** は {{domxref("Node")}} インターフェイスの読み取り専用プロパティで、このノードの最上位の文書オブジェクトを返します。 -

ownerDocument プロパティは、指定ノードを内包するノードツリーのトップレベルのドキュメントオブジェクトを返します。

+## 値 -

構文

+すべての子ノードが作成された最上位の {{domxref("Document")}} オブジェクトです。 -
document = element.ownerDocument
-
+このプロパティが文書自身のノードで使用された場合、値は `null` になります。 - +## 例 -

+```js +// 指定された "p" から、文書オブジェクトの子である最上位の HTML を取得します。 -
var doc = p.ownerDocument; // ノード p のノードツリー上のトップレベル document オブジェクトを取得
-var html = doc.documentElement; // owner のドキュメント要素を取得
+const d = p.ownerDocument;
+const html = d.documentElement;
+```
 
-alert(html); // [object HTMLHtmlElement]
-
+## 仕様書 -

注記

+{{Specifications}} -

このプロパティによって返される document オブジェクトは、実際の HTML 文書中ですべての子ノードの属するメインオブジェクトです。document ノード自身に対しこのプロパティを用いた場合、戻り値は null となります。

+## ブラウザーの互換性 -

仕様

- - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{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")}}

+{{Compat}} -- cgit v1.2.3-54-g00ecf