mirror of
https://github.com/jquery/jquery.git
synced 2024-10-05 11:34:18 +00:00
CSS: Correctly detect scrollbox support with non-default zoom
Fixes gh-4029 Closes gh-4030
This commit is contained in:
parent
f8c1e9020c
commit
821bf34353
@ -352,13 +352,15 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
|
|||||||
boxSizingNeeded = scrollBoxSize || extra,
|
boxSizingNeeded = scrollBoxSize || extra,
|
||||||
isBorderBox = boxSizingNeeded &&
|
isBorderBox = boxSizingNeeded &&
|
||||||
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
||||||
subtract = extra && boxModelAdjustment(
|
subtract = extra ?
|
||||||
|
boxModelAdjustment(
|
||||||
elem,
|
elem,
|
||||||
dimension,
|
dimension,
|
||||||
extra,
|
extra,
|
||||||
isBorderBox,
|
isBorderBox,
|
||||||
styles
|
styles
|
||||||
);
|
) :
|
||||||
|
0;
|
||||||
|
|
||||||
// Account for unreliable border-box dimensions by comparing offset* to computed and
|
// Account for unreliable border-box dimensions by comparing offset* to computed and
|
||||||
// faking a content-box to get border and padding (gh-3699)
|
// faking a content-box to get border and padding (gh-3699)
|
||||||
|
@ -43,8 +43,10 @@ define( [
|
|||||||
|
|
||||||
// Support: IE 9 only
|
// Support: IE 9 only
|
||||||
// Detect overflow:scroll screwiness (gh-3699)
|
// Detect overflow:scroll screwiness (gh-3699)
|
||||||
|
// Support: Chrome <=64
|
||||||
|
// Don't get tricked when zoom affects offsetWidth (gh-4029)
|
||||||
div.style.position = "absolute";
|
div.style.position = "absolute";
|
||||||
scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
|
scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12 || "absolute";
|
||||||
|
|
||||||
documentElement.removeChild( container );
|
documentElement.removeChild( container );
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
zoom: 1.1;
|
zoom: 1.1;
|
||||||
}
|
}
|
||||||
#test {
|
#test {
|
||||||
|
position: absolute;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@ -20,7 +21,10 @@
|
|||||||
<script src="../../jquery.js"></script>
|
<script src="../../jquery.js"></script>
|
||||||
<script src="../iframeTest.js"></script>
|
<script src="../iframeTest.js"></script>
|
||||||
<script>
|
<script>
|
||||||
startIframeTest( jQuery( "#test" ).css( 'width' ) );
|
startIframeTest(
|
||||||
|
jQuery( "#test" ).css( 'width' ),
|
||||||
|
jQuery( "#test" ).css( 'width', '100px' ).css( 'width' )
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1167,9 +1167,10 @@ testIframe(
|
|||||||
testIframe(
|
testIframe(
|
||||||
"css('width') should work correctly with browser zooming",
|
"css('width') should work correctly with browser zooming",
|
||||||
"css/cssWidthBrowserZoom.html",
|
"css/cssWidthBrowserZoom.html",
|
||||||
function( assert, jQuery, window, document, cssWidthBrowserZoom ) {
|
function( assert, jQuery, window, document, widthBeforeSet, widthAfterSet ) {
|
||||||
assert.expect( 1 );
|
assert.expect( 2 );
|
||||||
assert.strictEqual( cssWidthBrowserZoom, "100px", "elem.css('width') works correctly with browser zoom" );
|
assert.strictEqual( widthBeforeSet, "100px", "elem.css('width') works correctly with browser zoom" );
|
||||||
|
assert.strictEqual( widthAfterSet, "100px", "elem.css('width', val) works correctly with browser zoom" );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user