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

Function augmentWidthOrHeight

2.1.1/src/css.js:69–106  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

67}
68
69function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
70 var i = extra === ( isBorderBox ? "border" : "content" ) ?
71 // If we already have the right measurement, avoid augmentation
72 4 :
73 // Otherwise initialize for horizontal or vertical properties
74 name === "width" ? 1 : 0,
75
76 val = 0;
77
78 for ( ; i < 4; i += 2 ) {
79 // Both box models exclude margin, so add it if we want it
80 if ( extra === "margin" ) {
81 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
82 }
83
84 if ( isBorderBox ) {
85 // border-box includes padding, so remove it if we want content
86 if ( extra === "content" ) {
87 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
88 }
89
90 // At this point, extra isn't border nor margin, so remove border
91 if ( extra !== "margin" ) {
92 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
93 }
94 } else {
95 // At this point, extra isn't content, so add padding
96 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
97
98 // At this point, extra isn't content nor padding, so add border
99 if ( extra !== "padding" ) {
100 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
101 }
102 }
103 }
104
105 return val;
106}
107
108function getWidthOrHeight( elem, name, extra ) {
109

Callers 2

getWidthOrHeightFunction · 0.70
css.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected