I'm trying to understand how jQuery arrives at pixel values for IE8 when dealing with non-pixel based property values, such as margin-top: 2em
, or even something like height: auto
. For IE9+, getComputedStyle()
can obviously provide this easily, but in the case of IE8, currentStyle
does not. I am trying to arrive at a solution so I can calculate the total height of an element, including CSS height, padding, border, and margin for all browsers IE8+. I have come across the following answer, but I can't understand what is going on in the accepted answer.
Cross-browser (IE8-) getComputedStyle with Javascript?
I was wondering if anyone could explain what is going on in this code?
here is a shim for computed style from WebPlatform.