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/comparedocumentposition/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/comparedocumentposition/index.html')
| -rw-r--r-- | files/fr/web/api/node/comparedocumentposition/index.html | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/files/fr/web/api/node/comparedocumentposition/index.html b/files/fr/web/api/node/comparedocumentposition/index.html deleted file mode 100644 index a40125b5c1..0000000000 --- a/files/fr/web/api/node/comparedocumentposition/index.html +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: Node.compareDocumentPosition() -slug: Web/API/Node/compareDocumentPosition -tags: - - API - - Arborescence - - DOM - - Méthodes - - Noeuds - - Position -translation_of: Web/API/Node/compareDocumentPosition ---- -<div>{{APIRef("DOM")}}</div> - -<p>La méthode <code><strong>Node.compareDocumentPosition()</strong></code>compare la position du noeud courant par rapport à un autre noeud dans tout autre document.</p> - -<p>La valeur retournée est un masque de bits avec les valeurs suivantes :</p> - -<table> - <thead> - <tr> - <th scope="col">Nom</th> - <th scope="col">Valeur</th> - </tr> - </thead> - <tbody> - <tr> - <td><code>DOCUMENT_POSITION_DISCONNECTED</code></td> - <td>1</td> - </tr> - <tr> - <td><code>DOCUMENT_POSITION_PRECEDING</code></td> - <td>2</td> - </tr> - <tr> - <td><code>DOCUMENT_POSITION_FOLLOWING</code></td> - <td>4</td> - </tr> - <tr> - <td><code>DOCUMENT_POSITION_CONTAINS</code></td> - <td>8</td> - </tr> - <tr> - <td><code>DOCUMENT_POSITION_CONTAINED_BY</code></td> - <td>16</td> - </tr> - <tr> - <td><code>DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC</code></td> - <td>32</td> - </tr> - </tbody> -</table> - -<h2 id="Syntax">Syntaxe</h2> - -<pre class="syntaxbox"><em>node</em>.compareDocumentPosition( <em>otherNode</em> ) -</pre> - -<h2 id="Example">Exemple</h2> - -<pre class="brush:js">var head = document.getElementsByTagName('head').item(0); - -if (head.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_FOLLOWING) { - console.log("well-formed document"); -} else { - console.log("<head> is not before <body>"); -} -</pre> - -<div class="note"> -<p><strong>Note :</strong> Parce que le résultat renvoyé par<em> </em><code>compareDocumentPosition</code> est un masque de bits, des <a href="/fr/docs/Web/JavaScript/Reference/Op%C3%A9rateurs/Op%C3%A9rateurs_binaires">opérateurs binaires</a> doivent être utilisés pour des résultats significatifs.</p> -</div> - -<div class="note"> -<p><strong>Note :</strong> La première instruction utilise l' <code>item(0)</code> de la méthode <a href="/en-US/docs/Web/API/NodeList/item">NodeList</a> , qui est l'équivalent de <code>getElementsByTagName('head')[0].</code></p> -</div> - -<h2 id="Specification">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-comparedocumentposition','Node.compareDocumentPosition()')}}</td> - <td>{{Spec2('DOM WHATWG')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('DOM3 Core','core.html#Node3-compareDocumentPosition','Node.compareDocumentPosition()')}}</td> - <td>{{Spec2('DOM3 Core')}}</td> - <td>Définition initiale</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("api.Node.compareDocumentPosition")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li><code><a href="/fr/docs/Web/API/Node/contains">Node.contains</a></code></li> -</ul> |
