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/document/createcomment/index.html | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 files/fr/web/api/document/createcomment/index.html (limited to 'files/fr/web/api/document/createcomment') diff --git a/files/fr/web/api/document/createcomment/index.html b/files/fr/web/api/document/createcomment/index.html new file mode 100644 index 0000000000..8aaa2be9f3 --- /dev/null +++ b/files/fr/web/api/document/createcomment/index.html @@ -0,0 +1,41 @@ +--- +title: document.createComment +slug: Web/API/Document/createComment +tags: + - API + - DOM + - Méthodes + - Reference +translation_of: Web/API/Document/createComment +--- +
{{APIRef("DOM")}}
+ +

createComment() crée et retourne un nouveau noeud de type commentaire.

+ +

Syntaxe

+ +
CommentNode = document.createComment(data)
+
+ +

Paramètres

+ +
+
data
+
Une chaîne de caractères représentant le contenu du commentaire.
+
+ +

Exemple

+ +
var docu = new DOMParser().parseFromString('<xml></xml>',  "application/xml");
+var comment = docu.createComment('Voici un commentaire pas très bien caché');
+
+docu.getElementsByTagName('xml')[0].appendChild(comment);
+
+alert(new XMLSerializer().serializeToString(docu));
+// Affiche: <xml><!--Voici un commentaire pas très bien caché--></xml>
+ +

Spécification

+ + -- cgit v1.2.3-54-g00ecf