diff options
author | MDN <actions@users.noreply.github.com> | 2021-05-22 00:42:07 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-05-22 00:42:07 +0000 |
commit | 156b518735b8da6cc954105b0a1250ca31449381 (patch) | |
tree | 6a0e35a9622dc00acfc816503410e9a4cd360bc4 /files/es/orphaned/web | |
parent | 73aff5bd1edf14df05228693ed569b652ce89eee (diff) | |
download | translated-content-156b518735b8da6cc954105b0a1250ca31449381.tar.gz translated-content-156b518735b8da6cc954105b0a1250ca31449381.tar.bz2 translated-content-156b518735b8da6cc954105b0a1250ca31449381.zip |
[CRON] sync translated content
Diffstat (limited to 'files/es/orphaned/web')
-rw-r--r-- | files/es/orphaned/web/api/childnode/remove/index.html | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/files/es/orphaned/web/api/childnode/remove/index.html b/files/es/orphaned/web/api/childnode/remove/index.html new file mode 100644 index 0000000000..069ed69160 --- /dev/null +++ b/files/es/orphaned/web/api/childnode/remove/index.html @@ -0,0 +1,95 @@ +--- +title: ChildNode.remove() +slug: orphaned/Web/API/ChildNode/remove +tags: + - API + - ChildNode + - DOM + - Experimental + - metodo +translation_of: Web/API/ChildNode/remove +original_slug: Web/API/ChildNode/remove +--- +<p><span id="result_box" lang="es"><span>{{APIRef ( "DOM")}}</span><br> + <span>El método<strong> ChildNode.remove ( ) </strong>elimina el objeto del árbol al que pertenece.</span></span></p> + +<h2 id="Sintaxis">Sintaxis</h2> + +<pre class="syntaxbox"><em>node</em>.remove(); +</pre> + +<h2 id="Ejemplo">Ejemplo</h2> + +<h3 id="Utilizando_remove">Utilizando <code>remove()</code></h3> + +<pre class="brush: html"><div id="div-01">Este es el div-01</div> +<div id="div-02">Este es el div-02</div> +<div id="div-03">Este es el div-03</div> +</pre> + +<pre class="brush: js">var el = document.getElementById('div-02'); +el.nextElementSibling.remove(); // Elimina el div con el id 'div-03' +</pre> + +<h3 id="ChildNode.remove_es_unscopable"><code>ChildNode.remove()</code> es unscopable</h3> + +<p><span id="result_box" lang="es"><span>El método <code>remove()</code> no está definido en el contexto de las declaración <code>with</code>.</span> <span>Consulte {{jsxref ("Symbol.unscopables")}} para obtener más información.</span></span></p> + +<pre class="brush: js">with(node) { + remove(); +} +// ReferenceError: remove is not defined </pre> + +<h2 id="Polyfill">Polyfill</h2> + +<p>El código a continuación es un polyfill del método <code>remove()</code> para Internet Explorer 9 y superiores:</p> + +<pre class="brush: js">// from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md +(function (arr) { + arr.forEach(function (item) { + if (item.hasOwnProperty('remove')) { + return; + } + Object.defineProperty(item, 'remove', { + configurable: true, + enumerable: true, + writable: true, + value: function remove() { + if (this.parentNode !== null) + this.parentNode.removeChild(this); + } + }); + }); +})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);</pre> + +<h2 id="Especificaciones">Especificaciones</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Especificación</th> + <th scope="col">Estado</th> + <th scope="col">Comentario</th> + </tr> + <tr> + <td>{{SpecName('DOM WHATWG', '#dom-childnode-remove', 'ChildNode.remove')}}</td> + <td>{{Spec2('DOM WHATWG')}}</td> + <td>Definición inicial.</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidad_en_los_navegadores">Compatibilidad en los navegadores</h2> + +<div> +<p>{{Compat("api.ChildNode.remove")}}</p> +</div> + +<h2 id="Ver_también">Ver también</h2> + +<ul> + <li><span class="short_text" id="result_box" lang="es"><span>La interfaz pura {{domxref ( "ChildNode")}} .</span></span></li> + <li> + <div class="syntaxbox"><span id="result_box" lang="es"><span>Tipos de objetos que implementan esta interfaz pura: {{domxref ( "CharacterData")}}, {{domxref ( "Elemento")}} y {{domxref ( "DocumentType")}}.</span></span></div> + </li> +</ul> |