From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/ru/web/api/document/createcomment/index.html | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 files/ru/web/api/document/createcomment/index.html (limited to 'files/ru/web/api/document/createcomment') diff --git a/files/ru/web/api/document/createcomment/index.html b/files/ru/web/api/document/createcomment/index.html new file mode 100644 index 0000000000..998d803e64 --- /dev/null +++ b/files/ru/web/api/document/createcomment/index.html @@ -0,0 +1,44 @@ +--- +title: Document.createComment() +slug: Web/API/Document/createComment +translation_of: Web/API/Document/createComment +--- +
{{ApiRef("DOM")}}
+ +

Основное

+ +

createComment() создаёт новый комментарий и возвращает его.

+ +

Синтаксис

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

Аргументы

+ +
+
data
+
Строка, которая будет внутри комментария
+
+ +

Пример

+ +
var docu = new DOMParser().parseFromString('<xml></xml>',  "application/xml");
+var comment = docu.createComment('Это комментарий на странице');
+
+docu.getElementsByTagName('xml')[0].appendChild(comment);
+
+alert(new XMLSerializer().serializeToString(docu));
+// Выведет: <xml><!--Это комментарий на странице--></xml>
+ +

Примечания

+ + + +

Спецификация

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