From c05efa8d7ae464235cf83d7c0956e42dc6974103 Mon Sep 17 00:00:00 2001 From: julieng Date: Sat, 2 Oct 2021 17:20:14 +0200 Subject: move *.html to *.md --- files/fr/web/api/node/getrootnode/index.html | 89 ---------------------------- 1 file changed, 89 deletions(-) delete mode 100644 files/fr/web/api/node/getrootnode/index.html (limited to 'files/fr/web/api/node/getrootnode/index.html') 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 ---- -

{{APIRef("DOM")}}

- -

La méthode getRootNode() 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.

- -

Syntaxe

- -
var root = node.getRootNode(options)
- -

Paramètres

- -
-
options {{optional_inline}}
-
Un objet qui définit les options pour obtenir le noeud racine. Les options disponibles sont : -
    -
  • composed : un {{jsxref('Boolean')}} (booléen) qui indique si la racine shadow doit être retournée (false (faux) par défaut) ou un noeud racine au-delà de la racine shadow (true).
  • -
-
-
- -

Retourne

- -

Une interface {{domxref('Node')}}.

- -

Exemple

- -

Le premier exemple retourne une référence au noeud HTML/document lorsqu'il est exécuté dans les navigateurs de support :

- -
rootNode = node.getRootNode();
- -

Cet exemple plus complexe montre la différence entre retourner une racine normale et une racine qui inclut la racine shadow (voir le code source complet):

- -
<!-- 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>
- -

Spécifications

- - - - - - - - - - - - - - -
SpécificationStatutCommentaire
{{SpecName('DOM WHATWG','#dom-node-getrootnode','getRootNode()')}}{{Spec2('DOM WHATWG')}}Définition initiale.
- -

Compatibilité des navigateurs

- -

{{Compat("api.Node.getRootNode")}}

\ No newline at end of file -- cgit v1.2.3-54-g00ecf