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/getrootnode/index.html | |
| 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/getrootnode/index.html')
| -rw-r--r-- | files/fr/web/api/node/getrootnode/index.html | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/files/fr/web/api/node/getrootnode/index.html b/files/fr/web/api/node/getrootnode/index.html deleted file mode 100644 index 5a6297d55b..0000000000 --- a/files/fr/web/api/node/getrootnode/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: Node.getRootNode() -slug: Web/API/Node/getRootNode -tags: - - API - - DOM - - Méthodes - - Noeuds - - Racine -translation_of: Web/API/Node/getRootNode ---- -<p>{{APIRef("DOM")}}</p> - -<p>La méthode <strong><code>getRootNode()</code></strong> de l'interface {{domxref("Node")}} renvoie le contexte de la racine de l'objet, qui peut optionnellement inclure la racine "shadow" si elle est disponible.</p> - -<h2 id="Syntaxe">Syntaxe</h2> - -<pre class="syntaxbox">var root = node.getRootNode(options)</pre> - -<h3 id="Paramètres">Paramètres</h3> - -<dl> - <dt>options {{optional_inline}}</dt> - <dd>Un objet qui définit les options pour obtenir le noeud racine. Les options disponibles sont : - <ul> - <li><code>composed</code> : un {{jsxref('Boolean')}} (<em>booléen</em>) qui indique si la racine shadow doit être retournée (<code>false</code> (<em>faux</em>) par défaut) ou un noeud racine au-delà de la racine shadow (<code>true</code>).</li> - </ul> - </dd> -</dl> - -<h3 id="Retourne">Retourne</h3> - -<p>Une interface {{domxref('Node')}}.</p> - -<h2 id="Exemple">Exemple</h2> - -<p>Le premier exemple retourne une référence au noeud HTML/document lorsqu'il est exécuté dans les navigateurs de support :</p> - -<pre class="brush: js">rootNode = node.getRootNode();</pre> - -<p>Cet exemple plus complexe montre la différence entre retourner une racine normale et une racine qui inclut la racine shadow (voir le <a href="https://github.com/jserz/js_piece/blob/master/DOM/Node/getRootNode()/demo/getRootNode.html">code source complet</a>):</p> - -<pre class="brush: html"><!-- source: https://github.com/jserz/js_piece/blob/master/DOM/Node/getRootNode()/demo/getRootNode.html --> -<div class="js-parent"> - <div class="js-child"></div> -</div> -<div class="js-shadowHost"></div> -<script> - // work on Chrome 54+,Opera41+ - - var parent = document.querySelector('.js-parent'), - child = document.querySelector('.js-child'), - shadowHost = document.querySelector('.js-shadowHost'); - - console.log(parent.getRootNode().nodeName); // #document - console.log(child.getRootNode().nodeName); // #document - - // create a ShadowRoot - var shadowRoot = shadowHost.attachShadow({mode:'open'}); - shadowRoot.innerHTML = '<style>div{background:#2bb8aa;}</style>' - + '<div class="js-shadowChild">content</div>'; - var shadowChild = shadowRoot.querySelector('.js-shadowChild'); - - // The default value of composed is false - console.log(shadowChild.getRootNode() === shadowRoot); // true - console.log(shadowChild.getRootNode({composed:false}) === shadowRoot); // true - console.log(shadowChild.getRootNode({composed:true}).nodeName); // #document -</script></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-node-getrootnode','getRootNode()')}}</td> - <td>{{Spec2('DOM WHATWG')}}</td> - <td>Définition initiale.</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("api.Node.getRootNode")}}</p>
\ No newline at end of file |
