From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/fr/web/api/domtokenlist/supports/index.html | 66 +++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 files/fr/web/api/domtokenlist/supports/index.html (limited to 'files/fr/web/api/domtokenlist/supports/index.html') diff --git a/files/fr/web/api/domtokenlist/supports/index.html b/files/fr/web/api/domtokenlist/supports/index.html new file mode 100644 index 0000000000..b536c5f40c --- /dev/null +++ b/files/fr/web/api/domtokenlist/supports/index.html @@ -0,0 +1,66 @@ +--- +title: DOMTokenList.supports() +slug: Web/API/DOMTokenList/supports +tags: + - API + - DOM + - Méthodes +translation_of: Web/API/DOMTokenList/supports +--- +

{{APIRef("DOM")}}{{SeeCompatTable}}

+ +

La méthode supports() de l'interface {{domxref("DOMTokenList")}} renvoie true (vrai) si une marque (token) donnée se trouve parmi les marques prises en charge dans l'attribut associé. Cette méthode est destinée à la détection des fonctionnalités.

+ +

Syntaxe

+ +
var boolean = element.supports(token)
+ +

Paramètres

+ +
+
token
+
Une {{domxref("DOMString")}} (chaîne de caractères) contenant la marque à interroger.
+
+ +

Renvoie

+ +

un {{jsxref("Boolean")}} (booléen) indiquant si la marque a été trouvée.

+ +

Exemple

+ +
var iframe = document.getElementById('display');
+if (iframe.sandbox.supports('an-upcoming-feature')) {
+  // code de support pour la future et mystérieuse fonctionnalité
+} else {
+  // code de secours
+}
+
+if (iframe.sandbox.supports('allow-scripts')) {
+  // instruction cadre de l'exécution de JavaScript
+   // NOTE: ceci fonctionne bien mais est juste un exemple!
+}
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('Credential Management')}}{{Spec2('Credential Management')}}Définition initiale.
+ +

Compatibilité des navigateurs

+ +
{{Compat("api.DOMTokenList.supports")}}
+ +
 
+ +
 
-- cgit v1.2.3-54-g00ecf