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/fr/web/api | |
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/fr/web/api')
-rw-r--r-- | files/fr/web/api/childnode/remove/index.html | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/files/fr/web/api/childnode/remove/index.html b/files/fr/web/api/childnode/remove/index.html deleted file mode 100644 index ad0b5ffa1c..0000000000 --- a/files/fr/web/api/childnode/remove/index.html +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: ChildNode.remove() -slug: Web/API/ChildNode/remove -tags: - - API - - DOM - - Méthodes - - Noeud Enfant -translation_of: Web/API/ChildNode/remove ---- -<div>{{APIRef("DOM")}}</div> - -<p>La méthode <code><strong>ChildNode.remove()</strong></code> retire l'objet de l'arbre auquel il appartient.</p> - -<h2 id="Syntaxe">Syntaxe</h2> - -<pre class="syntaxbox"><em>node</em>.remove(); -</pre> - -<h2 id="Exemple">Exemple</h2> - -<h3 id="Utilisation_de_la_méthode_remove">Utilisation de la méthode <code>remove()</code></h3> - -<pre class="brush: html"><div id="div-01">Here is div-01</div> -<div id="div-02">Here is div-02</div> -<div id="div-03">Here is div-03</div> -</pre> - -<pre class="brush: js">var el = document.getElementById('div-01'); -el.nextElementSibling.remove(); // Retire l'élément div dont l'id est 'div-02'</pre> - -<h3 id="ChildNode.remove_est_unscopable"><code>ChildNode.remove()</code> est <em>unscopable</em></h3> - -<p>La méthode <code>remove()</code> n'est pas comprise dans une instruction <code>with</code>. Voir {{jsxref("Symbol.unscopables")}} pour plus d'informations.</p> - -<pre class="brush: js">with(node) { - remove(); -} -// ReferenceError: remove is not defined (<em>remove n'est pas défini</em>)</pre> - -<h2 id="Prothèse_démulation">Prothèse d'émulation</h2> - -<p>Vous pouvez utiliser une prothèse d'émulation pour la méthode <code>remove()</code> dans Internet Explorer 9 et supérieur avec le code suivant :</p> - -<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="comment token">// from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md</span> -<span class="punctuation token">(</span><span class="keyword token">function</span> <span class="punctuation token">(</span>arr<span class="punctuation token">)</span> <span class="punctuation token">{</span> - arr<span class="punctuation token">.</span><span class="function token">forEach</span><span class="punctuation token">(</span><span class="keyword token">function</span> <span class="punctuation token">(</span>item<span class="punctuation token">)</span> <span class="punctuation token">{</span> - <span class="keyword token">if</span> <span class="punctuation token">(</span>item<span class="punctuation token">.</span><span class="function token">hasOwnProperty</span><span class="punctuation token">(</span><span class="string token">'remove'</span><span class="punctuation token">)</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> - <span class="keyword token">return</span><span class="punctuation token">;</span> - <span class="punctuation token">}</span> - Object<span class="punctuation token">.</span><span class="function token">defineProperty</span><span class="punctuation token">(</span>item<span class="punctuation token">,</span> <span class="string token">'remove'</span><span class="punctuation token">,</span> <span class="punctuation token">{</span> - configurable<span class="punctuation token">:</span> <span class="keyword token">true</span><span class="punctuation token">,</span> - enumerable<span class="punctuation token">:</span> <span class="keyword token">true</span><span class="punctuation token">,</span> - writable<span class="punctuation token">:</span> <span class="keyword token">true</span><span class="punctuation token">,</span> - value<span class="punctuation token">:</span> <span class="keyword token">function</span> <span class="function token">remove</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> - <span class="keyword token">if</span> <span class="punctuation token">(</span><span class="keyword token">this</span><span class="punctuation token">.</span>parentNode <span class="operator token">!==</span> <span class="keyword token">null</span><span class="punctuation token">)</span> - <span class="keyword token">this</span><span class="punctuation token">.</span>parentNode<span class="punctuation token">.</span><span class="function token">removeChild</span><span class="punctuation token">(</span><span class="keyword token">this</span><span class="punctuation token">)</span><span class="punctuation token">;</span> - <span class="punctuation token">}</span> - <span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span> - <span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span> -<span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">(</span><span class="punctuation token">[</span>Element<span class="punctuation token">.</span>prototype<span class="punctuation token">,</span> CharacterData<span class="punctuation token">.</span>prototype<span class="punctuation token">,</span> DocumentType<span class="punctuation token">.</span>prototype<span class="punctuation token">]</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> - -<h2 id="Spécifications">Spécifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Spécification</th> - <th scope="col">Statut</th> - <th scope="col">Commentaire</th> - </tr> - <tr> - <td>{{SpecName('DOM WHATWG', '#dom-childnode-remove', 'ChildNode.remove')}}</td> - <td>{{Spec2('DOM WHATWG')}}</td> - <td>Définition initiale</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<div>{{Compat("api.ChildNode.remove")}}</div> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li>L'interface simple {{domxref("ChildNode")}}.</li> - <li> - <div class="syntaxbox">Les types d'objets implémentant cette interface simple : {{domxref("CharacterData")}}, {{domxref("Element")}} et {{domxref("DocumentType")}}.</div> - </li> -</ul> |