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.


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);


Not part of any specification.

Microsoft had a description on MSDN.

Browser compatibility

BCD tables only load in the browser

See also