Debian Codegraph @

doc/pasdoc/html-parts/castle-engine-website-base/node_modules/jquery/src/css/curCSS.js

raw
1 define( [
2 "../core",
3 "../core/isAttached",
4 "./var/rboxStyle",
5 "./var/rnumnonpx",
6 "./var/getStyles",
7 "./var/rcustomProp",
8 "../var/rtrimCSS",
9 "./support"
10 ], function( jQuery, isAttached, rboxStyle, rnumnonpx, getStyles,
11 rcustomProp, rtrimCSS, support ) {
12
13 "use strict";
14
15 function curCSS( elem, name, computed ) {
16 var width, minWidth, maxWidth, ret,
17 isCustomProp = rcustomProp.test( name ),
18
19 // Support: Firefox 51+
20 // Retrieving style before computed somehow
21 // fixes an issue with getting wrong values
22 // on detached elements
23 style = elem.style;
24
25 computed = computed || getStyles( elem );
26
27 // getPropertyValue is needed for:
28 // .css('filter') (IE 9 only, trac-12537)
29 // .css('--customProperty) (gh-3144)
30 if ( computed ) {
31 ret = computed.getPropertyValue( name ) || computed[ name ];
32
33 // trim whitespace for custom property (issue gh-4926)
34 if ( isCustomProp ) {
35
36 // rtrim treats U+000D CARRIAGE RETURN and U+000C FORM FEED
37 // as whitespace while CSS does not, but this is not a problem
38 // because CSS preprocessing replaces them with U+000A LINE FEED
39 // (which *is* CSS whitespace)
40 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
41 ret = ret.replace( rtrimCSS, "$1" );
42 }
43
44 if ( ret === "" && !isAttached( elem ) ) {
45 ret = jQuery.style( elem, name );
46 }
47
48 // A tribute to the "awesome hack by Dean Edwards"
49 // Android Browser returns percentage for some values,
50 // but width seems to be reliably pixels.
51 // This is against the CSSOM draft spec:
52 // https://drafts.csswg.org/cssom/#resolved-values
53 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
54
55 // Remember the original values
56 width = style.width;
57 minWidth = style.minWidth;
58 maxWidth = style.maxWidth;
59
60 // Put in the new values to get a computed value out
61 style.minWidth = style.maxWidth = style.width = ret;
62 ret = computed.width;
63
64 // Revert the changed values
65 style.width = width;
66 style.minWidth = minWidth;
67 style.maxWidth = maxWidth;
68 }
69 }
70
71 return ret !== undefined ?
72
73 // Support: IE <=9 - 11 only
74 // IE returns zIndex value as an integer.
75 ret + "" :
76 ret;
77 }
78
79 return curCSS;
80 } );