MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / getWidthOrHeight

Function getWidthOrHeight

camera/jquery.js:5781–5823  ·  view source on GitHub ↗
( elem, name, extra )

Source from the content-addressed store, hash-verified

5779}
5780
5781function getWidthOrHeight( elem, name, extra ) {
5782
5783 // Start with offset property, which is equivalent to the border-box value
5784 var valueIsBorderBox = true,
5785 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
5786 styles = getStyles( elem ),
5787 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
5788
5789 // some non-html elements return undefined for offsetWidth, so check for null/undefined
5790 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
5791 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
5792 if ( val <= 0 || val == null ) {
5793 // Fall back to computed then uncomputed css if necessary
5794 val = curCSS( elem, name, styles );
5795 if ( val < 0 || val == null ) {
5796 val = elem.style[ name ];
5797 }
5798
5799 // Computed unit is not pixels. Stop here and return.
5800 if ( rnumnonpx.test(val) ) {
5801 return val;
5802 }
5803
5804 // we need the check for style in case a browser which returns unreliable values
5805 // for getComputedStyle silently falls back to the reliable elem.style
5806 valueIsBorderBox = isBorderBox &&
5807 ( support.boxSizingReliable() || val === elem.style[ name ] );
5808
5809 // Normalize "", auto, and prepare for extra
5810 val = parseFloat( val ) || 0;
5811 }
5812
5813 // use the active box-sizing model to add/subtract irrelevant styles
5814 return ( val +
5815 augmentWidthOrHeight(
5816 elem,
5817 name,
5818 extra || ( isBorderBox ? "border" : "content" ),
5819 valueIsBorderBox,
5820 styles
5821 )
5822 ) + "px";
5823}
5824
5825function showHide( elements, show ) {
5826 var display, elem, hidden,

Callers 1

jquery.jsFile · 0.70

Calls 3

getStylesFunction · 0.85
curCSSFunction · 0.85
augmentWidthOrHeightFunction · 0.85

Tested by

no test coverage detected