From 1ad9915d11e27ebce8016ef81163206fb68b2335 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82=C4=99biowski?= Date: Mon, 16 Nov 2015 21:55:08 +0100 Subject: [PATCH] Misc: Fix the tests, revert some unneeded/broken reverts Refs 65d71843b7c37dbdba2cfcb1bc7055cb522c5af6 --- src/css/curCSS.js | 11 +++++------ src/css/hiddenVisibleSelectors.js | 8 ++++---- src/css/support.js | 7 ++++--- src/offset.js | 6 +----- test/unit/dimensions.js | 4 ++-- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/css/curCSS.js b/src/css/curCSS.js index d95e287cf..be643ab54 100644 --- a/src/css/curCSS.js +++ b/src/css/curCSS.js @@ -5,7 +5,7 @@ define( [ "./var/getStyles", "./support", "../selector" // Get jQuery.contains -], function( jQuery, rnumnonpx, rmargin, getStyles ) { +], function( jQuery, rnumnonpx, rmargin, getStyles, support ) { function curCSS( elem, name, computed ) { var width, minWidth, maxWidth, ret, @@ -22,13 +22,12 @@ function curCSS( elem, name, computed ) { ret = jQuery.style( elem, name ); } - // Support: iOS < 6, Android 4.0-4.3 only // A tribute to the "awesome hack by Dean Edwards" - // iOS < 6 (at least) returns percentage for a larger set of values, - // but width seems to be reliably pixels - // this is against the CSSOM draft spec: + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: // http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { // Remember the original values width = style.width; diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js index 0d05be97e..cf0955d3e 100644 --- a/src/css/hiddenVisibleSelectors.js +++ b/src/css/hiddenVisibleSelectors.js @@ -4,15 +4,15 @@ define( [ ], function( jQuery ) { jQuery.expr.filters.hidden = function( elem ) { + return !jQuery.expr.filters.visible( elem ); +}; +jQuery.expr.filters.visible = function( elem ) { // Support: Opera <= 12.12 // Opera reports offsetWidths and offsetHeights less than zero on some elements // Use OR instead of AND as the element is not visible if either is true // See tickets #10406 and #13132 - return elem.offsetWidth <= 0 || elem.offsetHeight <= 0; -}; -jQuery.expr.filters.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); + return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0; }; } ); diff --git a/src/css/support.js b/src/css/support.js index 54d0d9c70..6070eb449 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -32,9 +32,10 @@ define( [ // Support: Firefox<29, Android 2.3 // Vendor-prefix box-sizing - "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + - "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + - "border:1px;padding:1px;width:4px;position:absolute"; + "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" + + "position:relative;display:block;" + + "margin:auto;border:1px;padding:1px;" + + "top:1%;width:50%"; div.innerHTML = ""; documentElement.appendChild( container ); diff --git a/src/offset.js b/src/offset.js index ae9ccc119..4352a9995 100644 --- a/src/offset.js +++ b/src/offset.js @@ -98,11 +98,7 @@ jQuery.fn.extend( { return box; } - // Support: BlackBerry 5, iOS 3 (original iPhone) - // If we don't have gBCR, just use 0,0 rather than error - if ( elem.getBoundingClientRect ) { - box = elem.getBoundingClientRect(); - } + box = elem.getBoundingClientRect(); win = getWindow( doc ); return { top: box.top + win.pageYOffset - docElem.clientTop, diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 9ffc6083c..44a729113 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -411,8 +411,8 @@ QUnit.test( "setters with and without box-sizing:border-box", function( assert ) // Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions). var parent = jQuery( "#foo" ).css( { width: "200px", height: "200px", "font-size": "16px" } ), - el_bb = jQuery( "
test
" ).appendTo( parent ), - el = jQuery( "
test
" ).appendTo( parent ); + el_bb = jQuery( "
" ).appendTo( parent ), + el = jQuery( "
" ).appendTo( parent ); jQuery.each( { "number": { set: 100, expected: 100 }, -- 2.39.5