Dimensions: Don't trust non-pixel computed width/height

Fixes gh-3611
Closes gh-3741
This commit is contained in:
Richard Gibson
2017-08-07 12:26:03 -04:00
committed by GitHub
parent f3c5776b82
commit 3cf1d14ccc
2 changed files with 29 additions and 2 deletions

View File

@@ -153,9 +153,13 @@ function getWidthOrHeight( elem, dimension, extra ) {
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
valueIsBorderBox = isBorderBox;
// Computed unit is not pixels. Stop here and return.
// Support: Firefox <=54
// Return a confounding non-pixel value or feign ignorance, as appropriate.
if ( rnumnonpx.test( val ) ) {
return val;
if ( !extra ) {
return val;
}
val = "auto";
}
// Check for style in case a browser which returns unreliable values