Fix outerWidth and outerHeight calculation in IE

This commit is contained in:
Andreas Hocevar
2017-03-22 15:07:06 +01:00
parent f4bf92a488
commit 1843698daf

View File

@@ -28,7 +28,7 @@ ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
*/ */
ol.dom.outerWidth = function(element) { ol.dom.outerWidth = function(element) {
var width = element.offsetWidth; var width = element.offsetWidth;
var style = element.currentStyle || getComputedStyle(element); var style = getComputedStyle(element);
width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10); width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
return width; return width;
@@ -44,7 +44,7 @@ ol.dom.outerWidth = function(element) {
*/ */
ol.dom.outerHeight = function(element) { ol.dom.outerHeight = function(element) {
var height = element.offsetHeight; var height = element.offsetHeight;
var style = element.currentStyle || getComputedStyle(element); var style = getComputedStyle(element);
height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
return height; return height;