diff options
Diffstat (limited to 'files/es/web/api/node/parentelement/index.html')
-rw-r--r-- | files/es/web/api/node/parentelement/index.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/files/es/web/api/node/parentelement/index.html b/files/es/web/api/node/parentelement/index.html new file mode 100644 index 0000000000..2a2e947a8d --- /dev/null +++ b/files/es/web/api/node/parentelement/index.html @@ -0,0 +1,46 @@ +--- +title: Node.parentElement +slug: Web/API/Node/elementoPadre +tags: + - API + - DOM + - NecesitaCompatiblidadNavegador + - Nodo + - Propiedad +translation_of: Web/API/Node/parentElement +--- +<div> +<div>{{APIRef("DOM")}}</div> +</div> + +<p>La propiedad de sólo lectura de <code><strong>Nodo.parentElement</strong></code> devuelve el nodo padre del DOM {{domxref("Element")}}, o <code>null</code>, si el nodo no tiene padre o si el padre no es un {{domxref("Element")}} DOM .</p> + +<h2 id="Sintaxis" name="Sintaxis">Sintaxis</h2> + +<pre class="syntaxbox"><em>elementoPadre</em> = <em>node</em>.parentElement</pre> + +<p>El <code>elementoPadre</code> es el padre del nodo actual. Esto es siempre un objecto {{domxref("Element")}} DOM, o <code>null</code>.</p> + +<h2 id="Ejemplo" name="Ejemplo">Ejemplo</h2> + +<pre class="brush:js">if (node.parentElement) { + node.parentElement.style.color = "red"; +}</pre> + +<h2 id="Compatibilidad_en_navegadores">Compatibilidad en navegadores</h2> + +<p>En algunos navegadores, la propiedad <code>elementoPadre</code> es solo definida en nodos que ellos mismos son {{domxref("Element")}}. En particular, esto no está definido en nodos de texto.</p> + +<p>{{Compat("api.Node.parentElement")}}</p> + +<h2 id="Especificación" name="Especificación">Especificación</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="Ver_también" name="Ver_también">Ver también</h2> + +<ul> + <li>{{domxref("Node.parentNode")}}</li> +</ul> |