From 1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde Mon Sep 17 00:00:00 2001 From: julieng Date: Sat, 2 Oct 2021 17:20:24 +0200 Subject: convert content to md --- files/fr/web/api/element/hasattributes/index.md | 79 ++++++++++--------------- 1 file changed, 31 insertions(+), 48 deletions(-) (limited to 'files/fr/web/api/element/hasattributes') diff --git a/files/fr/web/api/element/hasattributes/index.md b/files/fr/web/api/element/hasattributes/index.md index ec7c62931f..abd5571777 100644 --- a/files/fr/web/api/element/hasattributes/index.md +++ b/files/fr/web/api/element/hasattributes/index.md @@ -10,70 +10,53 @@ tags: - polyfill translation_of: Web/API/Element/hasAttributes --- -
{{ApiRef("DOM")}}
+{{ApiRef("DOM")}} -

La méthode hasAttributes(), rattachée à l'interface {{domxref("Element")}}, renvoie une valeur booléenne indiquant si le nœud courant a au moins un attribut ou non.

+La méthode **`hasAttributes()`**, rattachée à l'interface {{domxref("Element")}}, renvoie une valeur booléenne indiquant si le nœud courant a au moins un attribut ou non. -

Syntaxe

+## Syntaxe -
var result = element.hasAttributes();
+```js +var result = element.hasAttributes(); +``` -

Valeur de retour

+### Valeur de retour -
-
result
-
contient la valeur de retour true ou false.
-
+- `result` + - : contient la valeur de retour `true` ou `false`. -

Exemple

+## Exemple -
var foo = document.getElementById("foo");
+```js
+var foo = document.getElementById("foo");
 if (foo.hasAttributes()) {
     // faire quelque chose avec 'foo.attributes'
-}
+} +``` -

Polyfill

+## Polyfill -
;(function(prototype) {
+```js
+;(function(prototype) {
     prototype.hasAttributes = prototype.hasAttributes || function() {
-        return (this.attributes.length > 0);
+        return (this.attributes.length > 0);
     }
-})(Element.prototype);
+})(Element.prototype); +``` -

Spécifications

+## Spécifications - - - - - - - - - - - - - - - - - - - - - - - -
SpécificationStatutCommentaire
{{SpecName("DOM WHATWG", "#dom-element-hasattributes", "Element.hasAttributes()")}}{{Spec2('DOM WHATWG')}}Déplacé de l'interface {{domxref("Node")}} vers l'interface plus spécialisée {{domxref("Element")}}.
{{SpecName('DOM3 Core','#ID-NodeHasAttrs','hasAttributes()')}}{{Spec2('DOM3 Core')}}Pas de changement par rapport à {{SpecName("DOM2 Core")}}
{{SpecName('DOM2 Core','#ID-NodeHasAttrs','hasAttributes()')}}{{Spec2('DOM2 Core')}}Définition initiale, sur l'interface {{domxref("Node")}}.
+| Spécification | Statut | Commentaire | +| ---------------------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| {{SpecName("DOM WHATWG", "#dom-element-hasattributes", "Element.hasAttributes()")}} | {{Spec2('DOM WHATWG')}} | Déplacé de l'interface {{domxref("Node")}} vers l'interface plus spécialisée {{domxref("Element")}}. | +| {{SpecName('DOM3 Core','#ID-NodeHasAttrs','hasAttributes()')}} | {{Spec2('DOM3 Core')}} | Pas de changement par rapport à {{SpecName("DOM2 Core")}} | +| {{SpecName('DOM2 Core','#ID-NodeHasAttrs','hasAttributes()')}} | {{Spec2('DOM2 Core')}} | Définition initiale, sur l'interface {{domxref("Node")}}. | -

Compatibilité des navigateurs

+## Compatibilité des navigateurs -

{{Compat("api.Element.hasAttributes")}}

+{{Compat("api.Element.hasAttributes")}} -

Voir aussi

+## Voir aussi - +- {{domxref("Element.attributes")}} +- {{domxref("Element.hasAttribute()")}} -- cgit v1.2.3-54-g00ecf