aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/idbkeyrange/includes
diff options
context:
space:
mode:
authorjulieng <julien.gattelier@gmail.com>2021-10-02 17:20:24 +0200
committerSphinxKnight <SphinxKnight@users.noreply.github.com>2021-10-02 17:30:20 +0200
commit1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde (patch)
tree30a56efd3eff3a01bd1611e1840fdbbfacf544a4 /files/fr/web/api/idbkeyrange/includes
parentc05efa8d7ae464235cf83d7c0956e42dc6974103 (diff)
downloadtranslated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.tar.gz
translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.tar.bz2
translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.zip
convert content to md
Diffstat (limited to 'files/fr/web/api/idbkeyrange/includes')
-rw-r--r--files/fr/web/api/idbkeyrange/includes/index.md107
1 files changed, 47 insertions, 60 deletions
diff --git a/files/fr/web/api/idbkeyrange/includes/index.md b/files/fr/web/api/idbkeyrange/includes/index.md
index 911a8c044b..dbef422d06 100644
--- a/files/fr/web/api/idbkeyrange/includes/index.md
+++ b/files/fr/web/api/idbkeyrange/includes/index.md
@@ -9,93 +9,80 @@ tags:
- Reference
translation_of: Web/API/IDBKeyRange/includes
---
-<div>{{APIRef("IndexedDB")}}</div>
+{{APIRef("IndexedDB")}}
-<p>La méthode <code><strong>includes()</strong></code>, rattachée à l'interface {{domxref("IDBKeyRange")}}, renvoie un booléen si la clé est contenue dans un intervalle de clé.</p>
+La méthode **`includes()`**, rattachée à l'interface {{domxref("IDBKeyRange")}}, renvoie un booléen si la clé est contenue dans un intervalle de clé.
-<p>{{AvailableInWorkers}}</p>
+{{AvailableInWorkers}}
-<h2 id="Syntaxe">Syntaxe</h2>
+## Syntaxe
-<pre class="brush: js">myIncludesResult = myKeyRange.includes('A');</pre>
+```js
+myIncludesResult = myKeyRange.includes('A');
+```
-<h3 id="Paramètres">Paramètres</h3>
+### Paramètres
-<dl>
- <dt><code>key</code></dt>
- <dd>La clé dont on souhaite savoir si elle est dans l'intervalle.</dd>
-</dl>
+- `key`
+ - : La clé dont on souhaite savoir si elle est dans l'intervalle.
-<h3 id="Valeur_de_retour">Valeur de retour</h3>
+### Valeur de retour
-<p>Un booléen.</p>
+Un booléen.
-<h3 id="Exceptions">Exceptions</h3>
+### Exceptions
-<p>Cette méthode peut lever une exception {{domxref("DOMException")}} de type {{domxref("DataError")}} lorsque la clé fournie n'est pas une clé valide.</p>
+Cette méthode peut lever une exception {{domxref("DOMException")}} de type {{domxref("DataError")}} lorsque la clé fournie n'est pas une clé valide.
-<h2 id="Exemples">Exemples</h2>
+## Exemples
-<pre class="brush: js">var keyRangeValue = IDBKeyRange.bound('A', 'K', false, false);
+```js
+var keyRangeValue = IDBKeyRange.bound('A', 'K', false, false);
var monResultat = keyRangeValue.includes('F');
// Renvoie true
var monResultat = keyRangeValue.includes('W');
// Renvoie false
-</pre>
+```
-<h2 id="Prothèse_d'émulation_(polyfill)">Prothèse d'émulation (<em>polyfill</em>)</h2>
+## Prothèse d'émulation (_polyfill_)
-<p>La méhode <code>includes()</code> a été ajoutée à partir de la deuxième édition de la spécification d'Indexed DB. Pour les navigateurs qui ne prennent pas en charge cette fonctionnalité, on peut utiliser la prothèse suivante.</p>
+La méhode `includes()` a été ajoutée à partir de la deuxième édition de la spécification d'Indexed DB. Pour les navigateurs qui ne prennent pas en charge cette fonctionnalité, on peut utiliser la prothèse suivante.
-<pre class="brush: js">IDBKeyRange.prototype.includes = IDBKeyRange.prototype.includes || function(key) {
+```js
+IDBKeyRange.prototype.includes = IDBKeyRange.prototype.includes || function(key) {
var r = this, c;
if (r.lower !== undefined) {
c = indexedDB.cmp(key, r.lower);
- if (r.lowerOpen &amp;&amp; c &lt;= 0) return false;
- if (!r.lowerOpen &amp;&amp; c &lt; 0) return false;
+ if (r.lowerOpen && c <= 0) return false;
+ if (!r.lowerOpen && c < 0) return false;
}
if (r.upper !== undefined) {
c = indexedDB.cmp(key, r.upper);
- if (r.upperOpen &amp;&amp; c &gt;= 0) return false;
- if (!r.upperOpen &amp;&amp; c &gt; 0) return false;
+ if (r.upperOpen && c >= 0) return false;
+ if (!r.upperOpen && c > 0) return false;
}
return true;
};
-</pre>
-
-<h2 id="Specifications">Spécifications</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">Spécification</th>
- <th scope="col">Statut</th>
- <th scope="col">Commentaire</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName('IndexedDB 2', '#dom-idbkeyrange-includes', 'includes()')}}</td>
- <td>{{Spec2('IndexedDB')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility">Compatibilité des navigateurs</h2>
-
-<p>{{Compat("api.IDBKeyRange.includes")}}</p>
-
-<h2 id="See_also">Voir aussi</h2>
-
-<ul>
- <li><a href="/fr/docs/Web/API/API_IndexedDB/Using_IndexedDB">Utiliser IndexedDB</a></li>
- <li>Initier une connexion : {{domxref("IDBDatabase")}}</li>
- <li>Utiliser les transactions : {{domxref("IDBTransaction")}}</li>
- <li>Définir un intervalle de clés : {{domxref("IDBKeyRange")}}</li>
- <li>Récupérer et modifier les données : {{domxref("IDBObjectStore")}}</li>
- <li>Utiliser les curseurs {{domxref("IDBCursor")}}</li>
- <li>Exemple de référence : <a href="https://github.com/mdn/to-do-notifications/tree/gh-pages">To-do Notifications</a> (<a href="https://mdn.github.io/to-do-notifications/">exemple <em>live</em></a>).</li>
-</ul>
+```
+
+## Spécifications
+
+| Spécification | Statut | Commentaire |
+| -------------------------------------------------------------------------------------------- | ---------------------------- | ----------- |
+| {{SpecName('IndexedDB 2', '#dom-idbkeyrange-includes', 'includes()')}} | {{Spec2('IndexedDB')}} |   |
+
+## Compatibilité des navigateurs
+
+{{Compat("api.IDBKeyRange.includes")}}
+
+## Voir aussi
+
+- [Utiliser IndexedDB](/fr/docs/Web/API/API_IndexedDB/Using_IndexedDB)
+- Initier une connexion : {{domxref("IDBDatabase")}}
+- Utiliser les transactions : {{domxref("IDBTransaction")}}
+- Définir un intervalle de clés : {{domxref("IDBKeyRange")}}
+- Récupérer et modifier les données : {{domxref("IDBObjectStore")}}
+- Utiliser les curseurs {{domxref("IDBCursor")}}
+- Exemple de référence : [To-do Notifications](https://github.com/mdn/to-do-notifications/tree/gh-pages) ([exemple _live_](https://mdn.github.io/to-do-notifications/)).