From 99efa5cfa34c3f9d38b75352881acdfc99508ebf Mon Sep 17 00:00:00 2001 From: tristantheb Date: Fri, 2 Apr 2021 13:50:14 +0200 Subject: UPDATE: FR-ONLY - Remove all old CompatibilityTable to replace with {{Compat()}} (#311) * UPDATE: Removing CompatibilityTable script - Part 1 * UPDATE: Removing CompatibilityTable script - Part 2 * UPDATE: Removing CompatibilityTable script - Part 3 * UPDATE: Removing CompatibilityTable script - Part 4 * UPDATE: Removing CompatibilityTable script - Part 5/5 * FIX: Repair the EOL of one page * FIX: Fix conflicting file --- files/fr/web/api/node/haschildnodes/index.html | 134 +++++++++---------------- 1 file changed, 45 insertions(+), 89 deletions(-) (limited to 'files/fr/web/api/node/haschildnodes') diff --git a/files/fr/web/api/node/haschildnodes/index.html b/files/fr/web/api/node/haschildnodes/index.html index 93d5f636aa..d0af3b4b65 100644 --- a/files/fr/web/api/node/haschildnodes/index.html +++ b/files/fr/web/api/node/haschildnodes/index.html @@ -4,119 +4,75 @@ slug: Web/API/Node/hasChildNodes tags: - API - DOM - - Enfant - - Méthodes - - Noeuds + - Method + - NeedsSpecTable + - Node + - Reference translation_of: Web/API/Node/hasChildNodes ---

{{APIRef("DOM")}}

-

La méthode Node.hasChildNodes() renvoie une valeur booléenne indiquant si le {{domxref("Node","noeud")}} actuel possède des nœuds enfants ou non.

+

La méthode Node.hasChildNodes() renvoie un {{jsxref("Boolean")}} indiquant si le {{domxref("Node","noeud")}} actuel possède des nœuds enfants ou non.

-

Syntaxe

+

Syntaxe

-
resultat =element.hasChildNodes();
-
+
bool = node.hasChildNodes();
-

Exemple

+

Valeur de retour

-

L'exemple suivant supprime le premier noeud enfant à l'intérieur de l'élément avec l'identifiant "foo" si "foo" a des noeuds enfant.

+

Un {{jsxref("Boolean")}} qui est true si le nœud a des nœuds enfants, et false dans le cas contraire.

-
var foo = document.getElementById("foo");
-if (foo.hasChildNodes()) {
-    // faire quelque chose avec les 'foo.childNodes'
-}
+

Exemple

-

Polyfill

+
let foo = document.getElementById('foo');
 
-

 

+if (foo.hasChildNodes()) { + // Faire quelque chose avec 'foo.childNodes' +}
-
;(function(prototype) {
-    prototype.hasChildNodes = prototype.hasChildNodes || function() {
-        return !!this.firstChild;
-    }
-})(Node.prototype);
+

Prothèse d'émulation

-

Résumé

+
(function(prototype) {
+  prototype.hasChildNodes = prototype.hasChildNodes || function() {
+    return !!this.firstChild;
+  }
+})(Node.prototype);

Il y a différentes façons de déterminer si le noeud a un noeud enfant :

-

Spécification

- - - -

Compatibilité des navigateurs

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - - - +

Spécification

+ +
FonctionnalitéChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}7.0{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+ + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName("DOM WHATWG", "#dom-node-haschildnodes", "Node: hasChildNodes")}} + {{Spec2("DOM WHATWG")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FonctionnalitéAndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
-

 

+

Compatibilité des navigateurs

+ +

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

-

Voir aussi

+

Voir aussi

- -
 
- -

 

-- cgit v1.2.3-54-g00ecf