MCPcopy Create free account
hub / github.com/JsAaron/jQuery / augmentWidthOrHeight

Function augmentWidthOrHeight

2.1.1/test/jquery-2.1.1.js:5741–5778  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

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

Callers 2

getWidthOrHeightFunction · 0.70
jquery-2.1.1.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected