aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/node/parentnode/index.html
blob: 7eefdd05d2e4a89f69426b55a8fe4fa0a74e4cf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
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>
<div>
 {{CompatibilityTable}}</div>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>機能</th>
    <th>Firefox (Gecko)</th>
    <th>Chrome</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari</th>
   </tr>
   <tr>
    <td>基本サポート</td>
    <td>{{CompatGeckoDesktop(1.0)}}</td>
    <td>0.2</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>{{CompatVersionUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>機能</th>
    <th>Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Mobile</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>基本サポート</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>{{CompatGeckoMobile(1)}}</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>{{CompatVersionUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<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>