mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Support: Properly check for IE9 absolute scrollbox mishandling
Ref gh-3589 Fixes gh-3699 Fixes gh-3730 Closes gh-3729
This commit is contained in:
@@ -378,7 +378,7 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
|
||||
|
||||
// Account for unreliable border-box dimensions by comparing offset* to computed and
|
||||
// faking a content-box to get border and padding (gh-3699)
|
||||
if ( isBorderBox && !support.borderBoxReliable() ) {
|
||||
if ( isBorderBox && support.scrollboxSize() === styles.position ) {
|
||||
subtract -= Math.ceil(
|
||||
elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
|
||||
parseFloat( styles[ dimension ] ) -
|
||||
|
||||
@@ -18,29 +18,33 @@ define( [
|
||||
return;
|
||||
}
|
||||
|
||||
container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
|
||||
"margin-top:1px;padding:0;border:0";
|
||||
div.style.cssText =
|
||||
"box-sizing:border-box;" +
|
||||
"position:relative;display:block;" +
|
||||
"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
|
||||
"margin:auto;border:1px;padding:1px;" +
|
||||
"top:1%;width:50%";
|
||||
div.innerHTML = "";
|
||||
documentElement.appendChild( container );
|
||||
"width:60%;top:1%";
|
||||
documentElement.appendChild( container ).appendChild( div );
|
||||
|
||||
var divStyle = window.getComputedStyle( div );
|
||||
pixelPositionVal = divStyle.top !== "1%";
|
||||
|
||||
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
|
||||
reliableMarginLeftVal = divStyle.marginLeft === "2px";
|
||||
boxSizingReliableVal = divStyle.width === "5px";
|
||||
|
||||
// Support: IE 9 only
|
||||
// Detect misreporting of content dimensions for border-box elements (gh-3699)
|
||||
borderBoxReliableVal = divStyle.width[ 0 ] === "5";
|
||||
reliableMarginLeftVal = divStyle.marginLeft === "12px";
|
||||
|
||||
// Support: Android 4.0 - 4.3 only
|
||||
// Some styles come back with percentage values, even though they shouldn't
|
||||
div.style.marginRight = "50%";
|
||||
pixelMarginRightVal = divStyle.marginRight === "5px";
|
||||
div.style.marginRight = "60%";
|
||||
pixelMarginRightVal = divStyle.marginRight === "36px";
|
||||
|
||||
// Support: IE 9 - 11 only
|
||||
// Detect misreporting of content dimensions for box-sizing:border-box elements
|
||||
boxSizingReliableVal = divStyle.width === "36px";
|
||||
|
||||
// Support: IE 9 only
|
||||
// Detect overflow:scroll screwiness (gh-3699)
|
||||
div.style.position = "absolute";
|
||||
scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
|
||||
|
||||
documentElement.removeChild( container );
|
||||
|
||||
@@ -49,7 +53,7 @@ define( [
|
||||
div = null;
|
||||
}
|
||||
|
||||
var pixelPositionVal, boxSizingReliableVal, borderBoxReliableVal, pixelMarginRightVal,
|
||||
var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelMarginRightVal,
|
||||
reliableMarginLeftVal,
|
||||
container = document.createElement( "div" ),
|
||||
div = document.createElement( "div" );
|
||||
@@ -65,15 +69,7 @@ define( [
|
||||
div.cloneNode( true ).style.backgroundClip = "";
|
||||
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
||||
|
||||
container.style.cssText = "border:0;width:10px;height:0;top:0;left:-9999px;" +
|
||||
"padding:0;margin-top:1px;position:absolute";
|
||||
container.appendChild( div );
|
||||
|
||||
jQuery.extend( support, {
|
||||
borderBoxReliable: function() {
|
||||
computeStyleTests();
|
||||
return borderBoxReliableVal;
|
||||
},
|
||||
boxSizingReliable: function() {
|
||||
computeStyleTests();
|
||||
return boxSizingReliableVal;
|
||||
@@ -89,6 +85,10 @@ define( [
|
||||
reliableMarginLeft: function() {
|
||||
computeStyleTests();
|
||||
return reliableMarginLeftVal;
|
||||
},
|
||||
scrollboxSize: function() {
|
||||
computeStyleTests();
|
||||
return scrollboxSizeVal;
|
||||
}
|
||||
} );
|
||||
} )();
|
||||
|
||||
Reference in New Issue
Block a user