Skip to content

Commit

Permalink
Misc: Fix the tests, revert some unneeded/broken reverts
Browse files Browse the repository at this point in the history
Refs 65d7184
  • Loading branch information
mgol committed Nov 16, 2015
1 parent 65d7184 commit 1ad9915
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
11 changes: 5 additions & 6 deletions src/css/curCSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/css/hiddenVisibleSelectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

} );
7 changes: 4 additions & 3 deletions src/css/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
6 changes: 1 addition & 5 deletions src/offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions test/unit/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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( "<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;'>test</div>" ).appendTo( parent ),
el = jQuery( "<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>" ).appendTo( parent );
el_bb = jQuery( "<div style='margin:5px;padding:1px;border:2px solid black;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;'></div>" ).appendTo( parent ),
el = jQuery( "<div style='margin:5px;padding:1px;border:2px solid black;'></div>" ).appendTo( parent );

jQuery.each( {
"number": { set: 100, expected: 100 },
Expand Down

0 comments on commit 1ad9915

Please sign in to comment.