Nasi wolontariusze nie przetłumaczyli jeszcze tego artykułu na język Polski. Dołącz do nas i pomóż go przetłumaczyć!
Można także przeczytać artykuł w języku: English (US).

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Element.currentStyle is a proprietary property which is similar to the standardized window.getComputedStyle() method. It is available in old versions of Microsoft Internet Explorer. However, it returns the units set in CSS while window.getComputedStyle() returns the values in pixels.

Polyfill

This polyfill returns the values in pixels and is likely to be rather slow, as it has to call window.getComputedStyle() every time its value is read.

/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

if (!("currentStyle" in Element.prototype)) {
  Object.defineProperty(Element.prototype, "currentStyle", {
    get: function() {
      return window.getComputedStyle(this);
    }
  });
}

Specification

Not part of any specification.

Microsoft has a description on MSDN.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Non-standard
Chrome No support NoEdge No support NoFirefox No support NoIE Full support 6Opera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.

See also

Autorzy i etykiety dokumentu

Ostatnia aktualizacja: ExE-Boss,