| @@ 6990-7047 (lines=58) @@ | ||
| 6987 | return val; |
|
| 6988 | } |
|
| 6989 | ||
| 6990 | function getWidthOrHeight( elem, name, extra ) { |
|
| 6991 | ||
| 6992 | // Start with offset property, which is equivalent to the border-box value |
|
| 6993 | var valueIsBorderBox = true, |
|
| 6994 | val = name === "width" ? elem.offsetWidth : elem.offsetHeight, |
|
| 6995 | styles = getStyles( elem ), |
|
| 6996 | isBorderBox = support.boxSizing && |
|
| 6997 | jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
|
| 6998 | ||
| 6999 | // Support: IE11 only |
|
| 7000 | // In IE 11 fullscreen elements inside of an iframe have |
|
| 7001 | // 100x too small dimensions (gh-1764). |
|
| 7002 | if ( document.msFullscreenElement && window.top !== window ) { |
|
| 7003 | ||
| 7004 | // Support: IE11 only |
|
| 7005 | // Running getBoundingClientRect on a disconnected node |
|
| 7006 | // in IE throws an error. |
|
| 7007 | if ( elem.getClientRects().length ) { |
|
| 7008 | val = Math.round( elem.getBoundingClientRect()[ name ] * 100 ); |
|
| 7009 | } |
|
| 7010 | } |
|
| 7011 | ||
| 7012 | // some non-html elements return undefined for offsetWidth, so check for null/undefined |
|
| 7013 | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 |
|
| 7014 | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 |
|
| 7015 | if ( val <= 0 || val == null ) { |
|
| 7016 | ||
| 7017 | // Fall back to computed then uncomputed css if necessary |
|
| 7018 | val = curCSS( elem, name, styles ); |
|
| 7019 | if ( val < 0 || val == null ) { |
|
| 7020 | val = elem.style[ name ]; |
|
| 7021 | } |
|
| 7022 | ||
| 7023 | // Computed unit is not pixels. Stop here and return. |
|
| 7024 | if ( rnumnonpx.test( val ) ) { |
|
| 7025 | return val; |
|
| 7026 | } |
|
| 7027 | ||
| 7028 | // we need the check for style in case a browser which returns unreliable values |
|
| 7029 | // for getComputedStyle silently falls back to the reliable elem.style |
|
| 7030 | valueIsBorderBox = isBorderBox && |
|
| 7031 | ( support.boxSizingReliable() || val === elem.style[ name ] ); |
|
| 7032 | ||
| 7033 | // Normalize "", auto, and prepare for extra |
|
| 7034 | val = parseFloat( val ) || 0; |
|
| 7035 | } |
|
| 7036 | ||
| 7037 | // use the active box-sizing model to add/subtract irrelevant styles |
|
| 7038 | return ( val + |
|
| 7039 | augmentWidthOrHeight( |
|
| 7040 | elem, |
|
| 7041 | name, |
|
| 7042 | extra || ( isBorderBox ? "border" : "content" ), |
|
| 7043 | valueIsBorderBox, |
|
| 7044 | styles |
|
| 7045 | ) |
|
| 7046 | ) + "px"; |
|
| 7047 | } |
|
| 7048 | ||
| 7049 | jQuery.extend( { |
|
| 7050 | ||
| @@ 5951-6007 (lines=57) @@ | ||
| 5948 | return val; |
|
| 5949 | } |
|
| 5950 | ||
| 5951 | function getWidthOrHeight( elem, name, extra ) { |
|
| 5952 | ||
| 5953 | // Start with offset property, which is equivalent to the border-box value |
|
| 5954 | var valueIsBorderBox = true, |
|
| 5955 | val = name === "width" ? elem.offsetWidth : elem.offsetHeight, |
|
| 5956 | styles = getStyles( elem ), |
|
| 5957 | isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
|
| 5958 | ||
| 5959 | // Support: IE11 only |
|
| 5960 | // In IE 11 fullscreen elements inside of an iframe have |
|
| 5961 | // 100x too small dimensions (gh-1764). |
|
| 5962 | if ( document.msFullscreenElement && window.top !== window ) { |
|
| 5963 | ||
| 5964 | // Support: IE11 only |
|
| 5965 | // Running getBoundingClientRect on a disconnected node |
|
| 5966 | // in IE throws an error. |
|
| 5967 | if ( elem.getClientRects().length ) { |
|
| 5968 | val = Math.round( elem.getBoundingClientRect()[ name ] * 100 ); |
|
| 5969 | } |
|
| 5970 | } |
|
| 5971 | ||
| 5972 | // Some non-html elements return undefined for offsetWidth, so check for null/undefined |
|
| 5973 | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 |
|
| 5974 | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 |
|
| 5975 | if ( val <= 0 || val == null ) { |
|
| 5976 | ||
| 5977 | // Fall back to computed then uncomputed css if necessary |
|
| 5978 | val = curCSS( elem, name, styles ); |
|
| 5979 | if ( val < 0 || val == null ) { |
|
| 5980 | val = elem.style[ name ]; |
|
| 5981 | } |
|
| 5982 | ||
| 5983 | // Computed unit is not pixels. Stop here and return. |
|
| 5984 | if ( rnumnonpx.test( val ) ) { |
|
| 5985 | return val; |
|
| 5986 | } |
|
| 5987 | ||
| 5988 | // Check for style in case a browser which returns unreliable values |
|
| 5989 | // for getComputedStyle silently falls back to the reliable elem.style |
|
| 5990 | valueIsBorderBox = isBorderBox && |
|
| 5991 | ( support.boxSizingReliable() || val === elem.style[ name ] ); |
|
| 5992 | ||
| 5993 | // Normalize "", auto, and prepare for extra |
|
| 5994 | val = parseFloat( val ) || 0; |
|
| 5995 | } |
|
| 5996 | ||
| 5997 | // Use the active box-sizing model to add/subtract irrelevant styles |
|
| 5998 | return ( val + |
|
| 5999 | augmentWidthOrHeight( |
|
| 6000 | elem, |
|
| 6001 | name, |
|
| 6002 | extra || ( isBorderBox ? "border" : "content" ), |
|
| 6003 | valueIsBorderBox, |
|
| 6004 | styles |
|
| 6005 | ) |
|
| 6006 | ) + "px"; |
|
| 6007 | } |
|
| 6008 | ||
| 6009 | function showHide( elements, show ) { |
|
| 6010 | var display, elem, hidden, |
|