diff options
| author | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2022-02-26 00:16:32 +0900 |
|---|---|---|
| committer | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2022-03-05 22:14:26 +0900 |
| commit | 068058eea2550a1b3da98a3a5af70bc9172d2be2 (patch) | |
| tree | 33da4388caba62c729aeb7a8445f0144c0aba669 /files/ja/web/api/node/parentnode | |
| parent | ed6203f957a5616efa135b87368715645b251444 (diff) | |
| download | translated-content-068058eea2550a1b3da98a3a5af70bc9172d2be2.tar.gz translated-content-068058eea2550a1b3da98a3a5af70bc9172d2be2.tar.bz2 translated-content-068058eea2550a1b3da98a3a5af70bc9172d2be2.zip | |
2021/11/08 時点の英語版に同期
Diffstat (limited to 'files/ja/web/api/node/parentnode')
| -rw-r--r-- | files/ja/web/api/node/parentnode/index.md | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/files/ja/web/api/node/parentnode/index.md b/files/ja/web/api/node/parentnode/index.md index 33ea858b0c..d50c111b37 100644 --- a/files/ja/web/api/node/parentnode/index.md +++ b/files/ja/web/api/node/parentnode/index.md @@ -2,46 +2,46 @@ title: Node.parentNode slug: Web/API/Node/parentNode tags: - - DOM - - Gecko - - Gecko DOM Reference - - Node + - プロパティ + - リファレンス + - 読み取り専用 +browser-compat: api.Node.parentNode translation_of: Web/API/Node/parentNode --- -<div> - {{ApiRef}}</div> -<h2 id="Summary" name="Summary">概要</h2> -<p>指定されたノードの DOM ツリー内の親ノードを返します。</p> -<h2 id="Syntax" name="Syntax">構文</h2> -<pre class="syntaxbox"><var>parentNode</var> = <var>node</var>.parentNode -</pre> -<ul> - <li><code>parentNode</code> : 指定ノードの親ノード。要素の親ノードは、<code>Element</code> ノード、<code>Document</code> ノード、または <code>DocumentFragment</code> になります。</li> -</ul> -<h2 id="Example" name="Example">例</h2> -<pre class="brush:js">if (node.parentNode) { - // ツリー上に既に存在しない場合を除き、 - // ツリーからノードを削除します。 +{{APIRef("DOM")}} + +**`parentNode`** は {{domxref("Node")}} インターフェイスの読み取り専用プロパティで、 DOM ツリー内の特定のノードの親ノードを返します。 + +`Document` および `DocumentFragment` [ノード](/ja/docs/Web/API/Node/nodeType)には親が付くことはないので、 `parentNode` は常に `null` になります。 +ノードが生成されてからツリーに割り当てられていない場合も `null` を返します。 + +## 値 + +現在のノードの親に当たる {{domxref("Node")}} です。要素の親になるのは `Element` ノード、 `Document` ノード、 `DocumentFragment` ノードの何れかです。 + +## 例 + +```js +if (node.parentNode) { + // ノードがツリーの中にある場合は、ツリーから取り除く node.parentNode.removeChild(node); -}</pre> -<h2 id="Notes" name="Notes">注記</h2> -<p><code>parentNode</code> は、以下の<a href="/ja/docs/Web/API/Node.nodeType">ノードタイプ</a>については <code>null</code> を返します : <code>Attr</code> 、<code>Document</code> 、<code>DocumentFragment</code> 、<code>Entity</code> 、<code>Notation</code></p> -<p>また、ノードが作成された直後でまだツリーに加えられていない場合も <code>null</code> を返します。</p> -<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザ実装状況</h2> - -<p>{{Compat("api.Node.parentNode")}}</p> - -<h2 id="Specification" name="Specification">仕様書</h2> -<ul> - <li><a href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1060184317">DOM Level 2 Core: Node.parentNode</a></li> - <li><a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1060184317">DOM Level 3 Core: Node.parentNode</a></li> -</ul> -<h2 id="See_also" name="See_also">関連情報</h2> -<ul> - <li>{{Domxref("element.firstChild")}}</li> - <li>{{Domxref("element.lastChild")}}</li> - <li>{{Domxref("element.childNodes")}}</li> - <li>{{Domxref("element.nextSibling")}}</li> - <li>{{Domxref("element.previousSibling")}}</li> - <li>{{Domxref("Node.removeChild")}}</li> -</ul> +} +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{Domxref("Node.firstChild")}} +- {{Domxref("Node.lastChild")}} +- {{Domxref("Node.childNodes")}} +- {{Domxref("Node.nextSibling")}} +- {{Domxref("Node.parentElement")}} +- {{Domxref("Node.previousSibling")}} +- {{Domxref("Node.removeChild")}} |
