blob: 6d8b6a2d3bd25e8dde11a41c40ffbe3a69ea7d9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import jQuery from "../core.js";
import isAttached from "../core/isAttached.js";
import getStyles from "./var/getStyles.js";
import rcustomProp from "./var/rcustomProp.js";
import rtrim from "../var/rtrim.js";
function curCSS( elem, name, computed ) {
var ret,
isCustomProp = rcustomProp.test( name );
computed = computed || getStyles( elem );
// getPropertyValue is needed for `.css('--customProperty')` (gh-3144)
if ( computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ];
// trim whitespace for custom property (issue gh-4926)
if ( isCustomProp ) {
ret = ret.replace( rtrim, "$1" );
}
if ( ret === "" && !isAttached( elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret !== undefined ?
// Support: IE <=9 - 11+
// IE returns zIndex value as an integer.
ret + "" :
ret;
}
export default curCSS;
|