diff options
| author | julieng <julien.gattelier@gmail.com> | 2021-10-02 17:20:14 +0200 |
|---|---|---|
| committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-10-02 17:30:20 +0200 |
| commit | c05efa8d7ae464235cf83d7c0956e42dc6974103 (patch) | |
| tree | 6ea911b2f2010f63a026de6bb7a1a51e7690a7e1 /files/fr/web/api/node/parentelement/index.md | |
| parent | 13a5e017558b248ee1647d4a5825f183b51f09ad (diff) | |
| download | translated-content-c05efa8d7ae464235cf83d7c0956e42dc6974103.tar.gz translated-content-c05efa8d7ae464235cf83d7c0956e42dc6974103.tar.bz2 translated-content-c05efa8d7ae464235cf83d7c0956e42dc6974103.zip | |
move *.html to *.md
Diffstat (limited to 'files/fr/web/api/node/parentelement/index.md')
| -rw-r--r-- | files/fr/web/api/node/parentelement/index.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/files/fr/web/api/node/parentelement/index.md b/files/fr/web/api/node/parentelement/index.md new file mode 100644 index 0000000000..673cb3b8b2 --- /dev/null +++ b/files/fr/web/api/node/parentelement/index.md @@ -0,0 +1,53 @@ +--- +title: Node.parentElement +slug: Web/API/Node/parentElement +tags: + - API + - DOM + - Noeuds + - Propriétés + - parent +translation_of: Web/API/Node/parentElement +--- +<div> +<div> +<div>{{APIRef("DOM")}}</div> +</div> + +<div>La propriété en lecture seule <code><strong>Node.parentElement</strong></code> renvoie le parent du noeud DOM ({{domxref("Element")}}) ou <code><strong>null</strong></code> si ce dernier n'a pas de parent ou si le parent n'est pas un {{domxref("Element")}} du DOM.</div> +</div> + +<h2 id="Syntax">Syntaxe</h2> + +<pre class="syntaxbox"><em>parentElement</em> = <em>node</em>.parentElement +</pre> + +<p><code><strong>parentElement</strong></code> référence l'élément parent d'un nœud (<code><strong>node</strong></code>). C'est toujours un objet {{domxref("Element")}} du DOM ou <code>null</code>.</p> + +<h2 id="Example">Exemple</h2> + +<pre class="brush:js">if (node.parentElement) { + node.parentElement.style.color = "red"; +}</pre> + +<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> + +<p>Sur quelques navigateurs, la propriété <code>parentElement</code> est seulement définie sur les noeuds qui sont eux-mêmes des {{domxref("Element")}}. En particulier, elle n'est pas définie sur les noeuds texte.</p> + +<div> + + +<p>{{Compat("api.Node.parentElement")}}</p> +</div> + +<h2 id="Spécifications">Spécifications</h2> + +<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="See_also">Voir aussi</h2> + +<ul> + <li>{{domxref("Node.parentNode")}}</li> +</ul> |
