From 23212b34e690e857cbc46951dd8c018d181206cb Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski Date: Thu, 2 Jul 2015 01:20:18 +0200 Subject: CSS: Make .css("width") & .css("height") return fractional values Fixes gh-1724 Closes gh-2454 Refs gh-2439 --- src/css/support.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/css') diff --git a/src/css/support.js b/src/css/support.js index 17848d535..854fa6b36 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -4,8 +4,8 @@ define([ ], function( jQuery, support ) { (function() { - var div, container, style, a, pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, - reliableHiddenOffsetsVal, reliableMarginRightVal; + var div, container, style, a, pixelPositionVal, boxSizingReliableVal, gBCRDimensionsVal, + pixelMarginRightVal, reliableHiddenOffsetsVal, reliableMarginRightVal; // Setup div = document.createElement( "div" ); @@ -55,6 +55,13 @@ define([ return boxSizingReliableVal; }, + gBCRDimensions: function() { + if ( pixelPositionVal == null ) { + computeStyleTests(); + } + return gBCRDimensionsVal; + }, + pixelMarginRight: function() { // Support: Android 4.0-4.3 if ( pixelPositionVal == null ) { @@ -105,6 +112,10 @@ define([ pixelPositionVal = boxSizingReliableVal = false; pixelMarginRightVal = reliableMarginRightVal = true; + // Support: IE<9 + // In IE8 gBCR doesn't report width & height. + gBCRDimensionsVal = !!div.getBoundingClientRect().width; + // Check for getComputedStyle so that this code is not run in IE<9. if ( window.getComputedStyle ) { divStyle = window.getComputedStyle( div ); -- cgit v1.2.3