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

Function augmentWidthOrHeight

camera/jquery.js:5742–5779  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

5740}
5741
5742function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
5743 var i = extra === ( isBorderBox ? "border" : "content" ) ?
5744 // If we already have the right measurement, avoid augmentation
5745 4 :
5746 // Otherwise initialize for horizontal or vertical properties
5747 name === "width" ? 1 : 0,
5748
5749 val = 0;
5750
5751 for ( ; i < 4; i += 2 ) {
5752 // both box models exclude margin, so add it if we want it
5753 if ( extra === "margin" ) {
5754 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
5755 }
5756
5757 if ( isBorderBox ) {
5758 // border-box includes padding, so remove it if we want content
5759 if ( extra === "content" ) {
5760 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5761 }
5762
5763 // at this point, extra isn't border nor margin, so remove border
5764 if ( extra !== "margin" ) {
5765 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5766 }
5767 } else {
5768 // at this point, extra isn't content, so add padding
5769 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5770
5771 // at this point, extra isn't content nor padding, so add border
5772 if ( extra !== "padding" ) {
5773 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5774 }
5775 }
5776 }
5777
5778 return val;
5779}
5780
5781function getWidthOrHeight( elem, name, extra ) {
5782

Callers 2

getWidthOrHeightFunction · 0.85
jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected