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

Метод Document.createAttribute() создает новый атрибут узла и возвращает его.  Созданный объект узла реализует {{domxref("Attr")}} интерфейс . DOM не указывает, какие атрибуты могут быть добавлены к определенному элементу таким способом.

+ +
+

Строка, заданная в параметре, преобразуется в нижний регистр.

+
+ +

Syntax

+ +
attribute = document.createAttribute(name)
+
+ +

Parameters

+ + + +

Return value

+ +

A {{domxref("Attr")}} node.

+ +

Exceptions

+ + + +

Example

+ +
var node = document.getElementById("div1");
+var a = document.createAttribute("my_attrib");
+a.value = "newVal";
+node.setAttributeNode(a);
+console.log(node.getAttribute("my_attrib")); // "newVal"
+
+ +

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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('DOM WHATWG','#dom-document-createattribute','Document.createAttribute()')}}{{Spec2("DOM WHATWG")}}Точное поведение с прописными символами
{{SpecName('DOM3 Core','core.html#ID-1084891198','Document.createAttribute()')}}{{Spec2('DOM3 Core')}}No change.
{{SpecName('DOM2 Core','core.html#ID-1084891198','Document.createAttribute()')}}{{Spec2('DOM2 Core')}}No change.
{{SpecName('DOM1','level-one-core.html#ID-1084891198','Document.createAttribute()')}}{{Spec2('DOM1')}}Первоначальное определение.
+ +

Совместимость с браузерами

+ + + +

{{Compat("api.Document.createAttribute")}}

+ +

See also

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