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

Function augmentWidthOrHeight

2.1.1/test/other.js:3148–3185  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

3146}
3147
3148function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
3149 var i = extra === ( isBorderBox ? "border" : "content" ) ?
3150 // If we already have the right measurement, avoid augmentation
3151 4 :
3152 // Otherwise initialize for horizontal or vertical properties
3153 name === "width" ? 1 : 0,
3154
3155 val = 0;
3156
3157 for ( ; i < 4; i += 2 ) {
3158 // both box models exclude margin, so add it if we want it
3159 if ( extra === "margin" ) {
3160 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
3161 }
3162
3163 if ( isBorderBox ) {
3164 // border-box includes padding, so remove it if we want content
3165 if ( extra === "content" ) {
3166 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
3167 }
3168
3169 // at this point, extra isn't border nor margin, so remove border
3170 if ( extra !== "margin" ) {
3171 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
3172 }
3173 } else {
3174 // at this point, extra isn't content, so add padding
3175 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
3176
3177 // at this point, extra isn't content nor padding, so add border
3178 if ( extra !== "padding" ) {
3179 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
3180 }
3181 }
3182 }
3183
3184 return val;
3185}
3186
3187function getWidthOrHeight( elem, name, extra ) {
3188

Callers 2

getWidthOrHeightFunction · 0.70
other.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected