MCPcopy Create free account
hub / github.com/sql-js/sql.js / getWidthOrHeight

Function getWidthOrHeight

documentation/javascript/application.js:7696–7735  ·  view source on GitHub ↗
( elem, name, extra )

Source from the content-addressed store, hash-verified

7694}
7695
7696function getWidthOrHeight( elem, name, extra ) {
7697
7698 // Start with offset property, which is equivalent to the border-box value
7699 var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
7700 valueIsBorderBox = true,
7701 isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
7702
7703 // some non-html elements return undefined for offsetWidth, so check for null/undefined
7704 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
7705 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
7706 if ( val <= 0 || val == null ) {
7707 // Fall back to computed then uncomputed css if necessary
7708 val = curCSS( elem, name );
7709 if ( val < 0 || val == null ) {
7710 val = elem.style[ name ];
7711 }
7712
7713 // Computed unit is not pixels. Stop here and return.
7714 if ( rnumnonpx.test(val) ) {
7715 return val;
7716 }
7717
7718 // we need the check for style in case a browser which returns unreliable values
7719 // for getComputedStyle silently falls back to the reliable elem.style
7720 valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
7721
7722 // Normalize "", auto, and prepare for extra
7723 val = parseFloat( val ) || 0;
7724 }
7725
7726 // use the active box-sizing model to add/subtract irrelevant styles
7727 return ( val +
7728 augmentWidthOrHeight(
7729 elem,
7730 name,
7731 extra || ( isBorderBox ? "border" : "content" ),
7732 valueIsBorderBox
7733 )
7734 ) + "px";
7735}
7736
7737
7738// Try to determine the default display value of an element

Callers 1

application.jsFile · 0.85

Calls 1

augmentWidthOrHeightFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…