MCPcopy Create free account
hub / github.com/idank/explainshell / augmentWidthOrHeight

Function augmentWidthOrHeight

explainshell/web/static/js/jquery.js:7024–7061  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

7022}
7023
7024function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
7025 var i = extra === ( isBorderBox ? "border" : "content" ) ?
7026 // If we already have the right measurement, avoid augmentation
7027 4 :
7028 // Otherwise initialize for horizontal or vertical properties
7029 name === "width" ? 1 : 0,
7030
7031 val = 0;
7032
7033 for ( ; i < 4; i += 2 ) {
7034 // both box models exclude margin, so add it if we want it
7035 if ( extra === "margin" ) {
7036 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
7037 }
7038
7039 if ( isBorderBox ) {
7040 // border-box includes padding, so remove it if we want content
7041 if ( extra === "content" ) {
7042 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7043 }
7044
7045 // at this point, extra isn't border nor margin, so remove border
7046 if ( extra !== "margin" ) {
7047 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7048 }
7049 } else {
7050 // at this point, extra isn't content, so add padding
7051 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7052
7053 // at this point, extra isn't content nor padding, so add border
7054 if ( extra !== "padding" ) {
7055 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7056 }
7057 }
7058 }
7059
7060 return val;
7061}
7062
7063function getWidthOrHeight( elem, name, extra ) {
7064

Callers 2

getWidthOrHeightFunction · 0.85
jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected