aboutsummaryrefslogtreecommitdiffstats
path: root/src/css/curCSS.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/css/curCSS.js')
-rw-r--r--src/css/curCSS.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/css/curCSS.js b/src/css/curCSS.js
index 59a639f68..6d8b6a2d3 100644
--- a/src/css/curCSS.js
+++ b/src/css/curCSS.js
@@ -1,9 +1,12 @@
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;
+ var ret,
+ isCustomProp = rcustomProp.test( name );
computed = computed || getStyles( elem );
@@ -11,6 +14,11 @@ function curCSS( elem, name, computed ) {
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 );
}