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

Function augmentWidthOrHeight

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

Source from the content-addressed store, hash-verified

7652}
7653
7654function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
7655 var i = extra === ( isBorderBox ? "border" : "content" ) ?
7656 // If we already have the right measurement, avoid augmentation
7657 4 :
7658 // Otherwise initialize for horizontal or vertical properties
7659 name === "width" ? 1 : 0,
7660
7661 val = 0;
7662
7663 for ( ; i < 4; i += 2 ) {
7664 // both box models exclude margin, so add it if we want it
7665 if ( extra === "margin" ) {
7666 // we use jQuery.css instead of curCSS here
7667 // because of the reliableMarginRight CSS hook!
7668 val += jQuery.css( elem, extra + cssExpand[ i ], true );
7669 }
7670
7671 // From this point on we use curCSS for maximum performance (relevant in animations)
7672 if ( isBorderBox ) {
7673 // border-box includes padding, so remove it if we want content
7674 if ( extra === "content" ) {
7675 val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
7676 }
7677
7678 // at this point, extra isn't border nor margin, so remove border
7679 if ( extra !== "margin" ) {
7680 val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
7681 }
7682 } else {
7683 // at this point, extra isn't content, so add padding
7684 val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
7685
7686 // at this point, extra isn't content nor padding, so add border
7687 if ( extra !== "padding" ) {
7688 val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
7689 }
7690 }
7691 }
7692
7693 return val;
7694}
7695
7696function getWidthOrHeight( elem, name, extra ) {
7697

Callers 2

getWidthOrHeightFunction · 0.85
application.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…