aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2017-07-18 15:40:41 -0400
committerGitHub <noreply@github.com>2017-07-18 15:40:41 -0400
commit20cdf4e7de60f515a7acf6c70228c52668301d9b (patch)
treeb4629ff31128571e1eff1479901577152062256d /src
parent3fcddd6e72e7e318c0b062e391d60867732318ae (diff)
downloadjquery-20cdf4e7de60f515a7acf6c70228c52668301d9b.tar.gz
jquery-20cdf4e7de60f515a7acf6c70228c52668301d9b.zip
Support: Properly check for IE9 absolute scrollbox mishandling
Ref gh-3589 Fixes gh-3699 Fixes gh-3730 Closes gh-3729
Diffstat (limited to 'src')
-rw-r--r--src/css.js2
-rw-r--r--src/css/support.js44
2 files changed, 23 insertions, 23 deletions
diff --git a/src/css.js b/src/css.js
index 79e06319c..87bf2481d 100644
--- a/src/css.js
+++ b/src/css.js
@@ -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 ] ) -
diff --git a/src/css/support.js b/src/css/support.js
index 7b7945fef..97f5aad70 100644
--- a/src/css/support.js
+++ b/src/css/support.js
@@ -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;
}
} );
} )();