diff options
| author | Atsuto Yamashita <atyamash@yahoo-corp.jp> | 2022-03-15 19:47:35 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-15 19:47:35 +0900 |
| commit | 9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0 (patch) | |
| tree | 71952407ea41c86feabef4214610d59e15aae55d /files/ja/web/api/node/parentnode | |
| parent | c2678137db5f97ad1fe39e872529159a1afafec1 (diff) | |
| parent | 9e7fbb013772ebab9b35185f0d0836995acbe6db (diff) | |
| download | translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.tar.gz translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.tar.bz2 translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.zip | |
Merge branch 'main' into fix-typo-client-side-web-apis-intro-ja
Diffstat (limited to 'files/ja/web/api/node/parentnode')
| -rw-r--r-- | files/ja/web/api/node/parentnode/index.html | 47 | ||||
| -rw-r--r-- | files/ja/web/api/node/parentnode/index.md | 47 |
2 files changed, 47 insertions, 47 deletions
diff --git a/files/ja/web/api/node/parentnode/index.html b/files/ja/web/api/node/parentnode/index.html deleted file mode 100644 index 33ea858b0c..0000000000 --- a/files/ja/web/api/node/parentnode/index.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: Node.parentNode -slug: Web/API/Node/parentNode -tags: - - DOM - - Gecko - - Gecko DOM Reference - - Node -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) { - // ツリー上に既に存在しない場合を除き、 - // ツリーからノードを削除します。 - 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> diff --git a/files/ja/web/api/node/parentnode/index.md b/files/ja/web/api/node/parentnode/index.md new file mode 100644 index 0000000000..d50c111b37 --- /dev/null +++ b/files/ja/web/api/node/parentnode/index.md @@ -0,0 +1,47 @@ +--- +title: Node.parentNode +slug: Web/API/Node/parentNode +tags: + - プロパティ + - リファレンス + - 読み取り専用 +browser-compat: api.Node.parentNode +translation_of: Web/API/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); +} +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{Domxref("Node.firstChild")}} +- {{Domxref("Node.lastChild")}} +- {{Domxref("Node.childNodes")}} +- {{Domxref("Node.nextSibling")}} +- {{Domxref("Node.parentElement")}} +- {{Domxref("Node.previousSibling")}} +- {{Domxref("Node.removeChild")}} |
