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/element/hasattributes/index.html | 122 ++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 files/ru/web/api/element/hasattributes/index.html (limited to 'files/ru/web/api/element/hasattributes/index.html') diff --git a/files/ru/web/api/element/hasattributes/index.html b/files/ru/web/api/element/hasattributes/index.html new file mode 100644 index 0000000000..1ab3c40fd8 --- /dev/null +++ b/files/ru/web/api/element/hasattributes/index.html @@ -0,0 +1,122 @@ +--- +title: Element.hasAttributes() +slug: Web/API/Element/hasAttributes +translation_of: Web/API/Element/hasAttributes +--- +
{{ApiRef("DOM")}}
+ +

Метод Element.hasAttributes() возвращает Boolean значение, указывая содержит данный элемент какие-либо атрибуты или нет.

+ +

Синтаксис

+ +
var result = element.hasAttributes();
+ +
+
result
+
содержит возвращаемое значение true или false.
+
+ +

Пример

+ +
var foo = document.getElementById("foo");
+if (foo.hasAttributes()) {
+    // do something with 'foo.attributes'
+}
+
+ +

Polyfill

+ +
;(function(prototype) {
+    prototype.hasAttributes = prototype.hasAttributes || function() {
+        return (this.attributes.length > 0);
+    }
+})(Element.prototype);
+
+ +

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

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName("DOM WHATWG", "#dom-element-hasattributes", "Element.hasAttributes()")}}{{Spec2('DOM WHATWG')}}Moved from the {{domxref("Node")}} interface to the more specialized {{domxref("Element")}} interface.
{{SpecName('DOM3 Core','#ID-NodeHasAttrs','hasAttributes()')}}{{Spec2('DOM3 Core')}}No change from {{SpecName("DOM2 Core")}}
{{SpecName('DOM2 Core','#ID-NodeHasAttrs','hasAttributes()')}}{{Spec2('DOM2 Core')}}Initial definition, on the {{domxref("Node")}} interface.
+ +

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

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }} [1]9{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
+
+ +

[1] Before Firefox 35, it was implemented on the {{domxref("Node")}} interface.

+ +

Смотрите также

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