MCPcopy Create free account
hub / github.com/TruthHun/BookStack / augmentWidthOrHeight

Function augmentWidthOrHeight

static/wangEditor/js/lib/jquery-2.2.1.js:5907–5949  ·  view source on GitHub ↗
( elem, name, extra, isBorderBox, styles )

Source from the content-addressed store, hash-verified

5905}
5906
5907function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
5908 var i = extra === ( isBorderBox ? "border" : "content" ) ?
5909
5910 // If we already have the right measurement, avoid augmentation
5911 4 :
5912
5913 // Otherwise initialize for horizontal or vertical properties
5914 name === "width" ? 1 : 0,
5915
5916 val = 0;
5917
5918 for ( ; i < 4; i += 2 ) {
5919
5920 // Both box models exclude margin, so add it if we want it
5921 if ( extra === "margin" ) {
5922 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
5923 }
5924
5925 if ( isBorderBox ) {
5926
5927 // border-box includes padding, so remove it if we want content
5928 if ( extra === "content" ) {
5929 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5930 }
5931
5932 // At this point, extra isn't border nor margin, so remove border
5933 if ( extra !== "margin" ) {
5934 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5935 }
5936 } else {
5937
5938 // At this point, extra isn't content, so add padding
5939 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5940
5941 // At this point, extra isn't content nor padding, so add border
5942 if ( extra !== "padding" ) {
5943 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5944 }
5945 }
5946 }
5947
5948 return val;
5949}
5950
5951function getWidthOrHeight( elem, name, extra ) {
5952

Callers 2

getWidthOrHeightFunction · 0.70
jquery-2.2.1.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected