MCPcopy Index your code
hub / github.com/JsAaron/jQuery / augmentWidthOrHeight

Function augmentWidthOrHeight

2.0.3/2.0.3.js:6511–6548  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

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

Callers 2

getWidthOrHeightFunction · 0.70
2.0.3.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected