MCPcopy Create free account
hub / github.com/TruthHun/BookStack / getWidthOrHeight

Function getWidthOrHeight

static/wangEditor/js/lib/jquery-2.2.1.js:5951–6007  ·  view source on GitHub ↗
( elem, name, extra )

Source from the content-addressed store, hash-verified

5949}
5950
5951function 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

Callers 1

jquery-2.2.1.jsFile · 0.70

Calls 3

getStylesFunction · 0.85
curCSSFunction · 0.85
augmentWidthOrHeightFunction · 0.70

Tested by

no test coverage detected