Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support: Simplify the box-sizing test #1529

Merged
merged 1 commit into from
Mar 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function getWidthOrHeight( elem, name, extra ) {
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";

// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
Expand Down Expand Up @@ -366,7 +366,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
elem,
name,
extra,
support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
Expand Down
20 changes: 6 additions & 14 deletions src/css/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define([

(function() {
// Minified: var b,c,d,e,f,g, h,i
var div, style, a, pixelPositionVal, boxSizingVal, boxSizingReliableVal,
var div, style, a, pixelPositionVal, boxSizingReliableVal,
reliableHiddenOffsetsVal, reliableMarginRightVal;

// Setup
Expand Down Expand Up @@ -33,6 +33,11 @@ define([
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";

// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt this support test no longer lazy as of now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but it shouldn't cause additional layouts. The style is from the <a> element.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it'll get even shorter once we remove MozBoxSizing. Probably not before 2.3, though, considering how crucial this is and that Firefox 24 ESR - the last one to have prefixed box-sizing - will be supported until the end of July.

style.WebkitBoxSizing === "";

jQuery.extend(support, {
reliableHiddenOffsets: function() {
if ( reliableHiddenOffsetsVal == null ) {
Expand All @@ -41,13 +46,6 @@ define([
return reliableHiddenOffsetsVal;
},

boxSizing: function() {
if ( boxSizingVal == null ) {
computeStyleTests();
}
return boxSizingVal;
},

boxSizingReliable: function() {
if ( boxSizingReliableVal == null ) {
computeStyleTests();
Expand Down Expand Up @@ -94,12 +92,6 @@ define([
"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
"border:1px;padding:1px;width:4px;position:absolute";

// Workaround failing boxSizing test due to offsetWidth returning wrong value
// with some non-1 values of body zoom, ticket #13543
jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
boxSizingVal = div.offsetWidth === 4;
});

// Support: IE<9
// Assume reasonable values in the absence of getComputedStyle
pixelPositionVal = false;
Expand Down
19 changes: 0 additions & 19 deletions test/data/support/boxSizing.html

This file was deleted.

5 changes: 0 additions & 5 deletions test/unit/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ if ( jQuery.css ) {
});
}

testIframeWithCallback( "A non-1 zoom on body doesn't cause WebKit to fail box-sizing test", "support/boxSizing.html", function( boxSizing ) {
expect( 1 );
equal( boxSizing, computedSupport.boxSizing, "box-sizing properly detected on page with non-1 body zoom" );
});

testIframeWithCallback( "A background on the testElement does not cause IE8 to crash (#9823)", "support/testElementCrash.html", function() {
expect( 1 );
ok( true, "IE8 does not crash" );
Expand Down