aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/node/parentelement
diff options
context:
space:
mode:
authorMasahiro FUJIMOTO <mfujimot@gmail.com>2022-02-26 00:16:32 +0900
committerMasahiro FUJIMOTO <mfujimot@gmail.com>2022-03-05 22:14:26 +0900
commit068058eea2550a1b3da98a3a5af70bc9172d2be2 (patch)
tree33da4388caba62c729aeb7a8445f0144c0aba669 /files/ja/web/api/node/parentelement
parented6203f957a5616efa135b87368715645b251444 (diff)
downloadtranslated-content-068058eea2550a1b3da98a3a5af70bc9172d2be2.tar.gz
translated-content-068058eea2550a1b3da98a3a5af70bc9172d2be2.tar.bz2
translated-content-068058eea2550a1b3da98a3a5af70bc9172d2be2.zip
2021/11/08 時点の英語版に同期
Diffstat (limited to 'files/ja/web/api/node/parentelement')
-rw-r--r--files/ja/web/api/node/parentelement/index.md49
1 files changed, 20 insertions, 29 deletions
diff --git a/files/ja/web/api/node/parentelement/index.md b/files/ja/web/api/node/parentelement/index.md
index e121601c07..8aa85b65f5 100644
--- a/files/ja/web/api/node/parentelement/index.md
+++ b/files/ja/web/api/node/parentelement/index.md
@@ -2,45 +2,36 @@
title: Node.parentElement
slug: Web/API/Node/parentElement
tags:
- - DOM
- - Element
- - Node
- - Property
- - parent
+ - プロパティ
+ - リファレンス
+ - 読み取り専用
+browser-compat: api.Node.parentElement
translation_of: Web/API/Node/parentElement
---
-<div>
-<div>{{APIRef("DOM")}}</div>
-</div>
+{{APIRef("DOM")}}
-<p><strong>Node.parentElement</strong>のread-only プロパティはDOM ノード上の親の {{domxref("Element")}} を返します。親ノードが存在しない場合や親ノードが DOM {{domxref("Element")}} で無い場合、<code>null</code> が返ります。</p>
+**`parentElement`** は {{domxref("Node")}} インターフェイスの読み取り専用プロパティで、この DOM ノードの親である要素 ({{DOMxRef("Element")}}) を返します。このノードに親ノードがないか、親が DOM の {{DOMxRef("Element")}} でない場合は `null` を返します。
-<h2 id="Syntax" name="Syntax">構文</h2>
+## 値
-<pre class="syntaxbox"><var>parentElement</var> = <em>node</em>.parentElement</pre>
+現在のノードの親ノードである {{domxref("Element")}} を返します。そのようなものがない場合は `null` を返します。
-<p><code>parentElement</code>は現nodeの親elementです。型は必ずDOM {{domxref("Element")}} オブジェクトか<code>nullです</code>。</p>
+## 例
-<h2 id="Example" name="Example">例</h2>
+```js
+if (node.parentElement) {
+ node.parentElement.style.color = "red";
+}
+```
-<pre class="brush:js">if (node.parentElement) {
- node.parentElement.style.color = "red";
-}</pre>
+## 仕様書
-<h2 id="Specification" name="Specification">仕様</h2>
+{{Specifications}}
-<ul>
- <li>{{spec("http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#parent-element", "DOM Level 4: Node.parentElement", "WD")}}</li>
-</ul>
+## ブラウザーの互換性
-<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザ実装状況</h2>
+{{Compat}}
-<p>{{Compat("api.Node.parentElement")}}</p>
+## 関連情報
-<p>一部のブラウザーでは、<code>parentElement</code>プロパティは {{domxref("Element")}} ノードでのみ定義されており、特にテキストノードに対して定義されていない場合がある点に注意して下さい。</p>
-
-<h2 id="See_also" name="See_also">関連情報</h2>
-
-<ul>
- <li>{{domxref("Node.parentNode")}}</li>
-</ul>
+- {{domxref("Node.parentNode")}}