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

Function augmentWidthOrHeight

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

Source from the content-addressed store, hash-verified

6514}
6515
6516function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6517 var i = extra === ( isBorderBox ? "border" : "content" ) ?
6518 // If we already have the right measurement, avoid augmentation
6519 4 :
6520 // Otherwise initialize for horizontal or vertical properties
6521 name === "width" ? 1 : 0,
6522
6523 val = 0;
6524
6525 for ( ; i < 4; i += 2 ) {
6526 // both box models exclude margin, so add it if we want it
6527 if ( extra === "margin" ) {
6528 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6529 }
6530
6531 if ( isBorderBox ) {
6532 // border-box includes padding, so remove it if we want content
6533 if ( extra === "content" ) {
6534 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6535 }
6536
6537 // at this point, extra isn't border nor margin, so remove border
6538 if ( extra !== "margin" ) {
6539 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6540 }
6541 } else {
6542 // at this point, extra isn't content, so add padding
6543 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6544
6545 // at this point, extra isn't content nor padding, so add border
6546 if ( extra !== "padding" ) {
6547 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6548 }
6549 }
6550 }
6551
6552 return val;
6553}
6554
6555function getWidthOrHeight( elem, name, extra ) {
6556

Callers 2

getWidthOrHeightFunction · 0.70
jquery-1.11.1.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected