MCPcopy Index your code
hub / github.com/JsAaron/jQuery / getWidthOrHeight

Function getWidthOrHeight

2.0.3/2.0.3.js:6550–6591  ·  view source on GitHub ↗
( elem, name, extra )

Source from the content-addressed store, hash-verified

6548 }
6549
6550 function getWidthOrHeight( elem, name, extra ) {
6551
6552 // Start with offset property, which is equivalent to the border-box value
6553 var valueIsBorderBox = true,
6554 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6555 styles = getStyles( elem ),
6556 isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6557
6558 // some non-html elements return undefined for offsetWidth, so check for null/undefined
6559 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
6560 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
6561 if ( val <= 0 || val == null ) {
6562 // Fall back to computed then uncomputed css if necessary
6563 val = curCSS( elem, name, styles );
6564 if ( val < 0 || val == null ) {
6565 val = elem.style[ name ];
6566 }
6567
6568 // Computed unit is not pixels. Stop here and return.
6569 if ( rnumnonpx.test(val) ) {
6570 return val;
6571 }
6572
6573 // we need the check for style in case a browser which returns unreliable values
6574 // for getComputedStyle silently falls back to the reliable elem.style
6575 valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
6576
6577 // Normalize "", auto, and prepare for extra
6578 val = parseFloat( val ) || 0;
6579 }
6580
6581 // use the active box-sizing model to add/subtract irrelevant styles
6582 return ( val +
6583 augmentWidthOrHeight(
6584 elem,
6585 name,
6586 extra || ( isBorderBox ? "border" : "content" ),
6587 valueIsBorderBox,
6588 styles
6589 )
6590 ) + "px";
6591 }
6592
6593// Try to determine the default display value of an element
6594 function css_defaultDisplay( nodeName ) {

Callers 1

2.0.3.jsFile · 0.70

Calls 3

getStylesFunction · 0.70
augmentWidthOrHeightFunction · 0.70
curCSSFunction · 0.50

Tested by

no test coverage detected