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/currentstyle/index.html | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 files/ru/web/api/element/currentstyle/index.html (limited to 'files/ru/web/api/element/currentstyle') diff --git a/files/ru/web/api/element/currentstyle/index.html b/files/ru/web/api/element/currentstyle/index.html new file mode 100644 index 0000000000..3df9fd524a --- /dev/null +++ b/files/ru/web/api/element/currentstyle/index.html @@ -0,0 +1,52 @@ +--- +title: Element.currentStyle +slug: Web/API/Element/currentStyle +tags: + - API + - NeedsExample + - Non-standard + - Property +translation_of: Web/API/Element/currentStyle +--- +

{{Non-standard_header}}

+ +

Element.currentStyle является собственностью, похожей на стандартизированную {{DOMxRef("window.getComputedStyle()")}} method. Он доступен в старых версиях Microsoft Internet Explorer. Однако, он возвращает единицы, установленные в CSS в то время как window.getComputedStyle()возвращает значения в пикселях.

+ +

Polyfill

+ +
+

Эта polyfill возвращает значения в пикселях и, скорее всего, будет довольно медленным, так как оно должно называться {{domxref("window.getComputedStyle()")}} каждый раз, когда читается его значение.

+
+ +
/* Любое авторское право посвящено Общественному достоянию.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+if (!("currentStyle" in Element.prototype)) {
+  Object.defineProperty(Element.prototype, "currentStyle", {
+    get: function() {
+      return window.getComputedStyle(this);
+    }
+  });
+}
+
+ +

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

+ +

Не входит ни в какие спецификации.

+ +

Microsoft had a description on MSDN.

+ +

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

+ + + +

{{Compat("api.Element.currentStyle")}}

+ +

См. также

+ + + +
{{APIRef("DOM")}}
-- cgit v1.2.3-54-g00ecf