Question: Is there a scenario where getBoundingClientRect
and window.getComputedStyle
would differ in width
or height
?
I just found a inconsistent width
(see under) in IE when a element has box-sizing
where window.getComputedStyle
returns the wrong value.
So I thought about overriding just width
and height
with values from getBoundingClientRect
but not sure if there are cases where that would fail.
Example of the problem (broken in IE): http://jsfiddle.net/bwPM8/
var box = document.querySelector('.box');
var gBCR_width = box.getBoundingClientRect().width; // always 200
var wGCS = window.getComputedStyle(box).width; // 200 some browsers, 160 in IE