MCPcopy Create free account
hub / github.com/TruthHun/BookStack / augmentWidthOrHeight

Function augmentWidthOrHeight

static/jquery/1.12.4/jquery.js:6947–6989  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

6945}
6946
6947function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6948 var i = extra === ( isBorderBox ? "border" : "content" ) ?
6949
6950 // If we already have the right measurement, avoid augmentation
6951 4 :
6952
6953 // Otherwise initialize for horizontal or vertical properties
6954 name === "width" ? 1 : 0,
6955
6956 val = 0;
6957
6958 for ( ; i < 4; i += 2 ) {
6959
6960 // both box models exclude margin, so add it if we want it
6961 if ( extra === "margin" ) {
6962 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6963 }
6964
6965 if ( isBorderBox ) {
6966
6967 // border-box includes padding, so remove it if we want content
6968 if ( extra === "content" ) {
6969 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6970 }
6971
6972 // at this point, extra isn't border nor margin, so remove border
6973 if ( extra !== "margin" ) {
6974 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6975 }
6976 } else {
6977
6978 // at this point, extra isn't content, so add padding
6979 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6980
6981 // at this point, extra isn't content nor padding, so add border
6982 if ( extra !== "padding" ) {
6983 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6984 }
6985 }
6986 }
6987
6988 return val;
6989}
6990
6991function getWidthOrHeight( elem, name, extra ) {
6992

Callers 2

getWidthOrHeightFunction · 0.70
jquery.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected