aboutsummaryrefslogtreecommitdiffstats
path: root/src/var
diff options
context:
space:
mode:
authorfecore1 <89127124+fecore1@users.noreply.github.com>2021-09-23 19:35:18 +0800
committerGitHub <noreply@github.com>2021-09-23 13:35:18 +0200
commitefadfe991a5c287af561a9326bf1427d726c91c1 (patch)
treea8d28d325f3b40a6bac0637ccfa10ac5974dbdf7 /src/var
parent175db73ec7938e774d9e93d3afdfb35a24466b47 (diff)
downloadjquery-efadfe991a5c287af561a9326bf1427d726c91c1.tar.gz
jquery-efadfe991a5c287af561a9326bf1427d726c91c1.zip
CSS: Trim whitespace surrounding CSS Custom Properties values
The spec has recently changed and CSS Custom Properties values are trimmed now. This change makes jQuery polyfill that new behavior for all browsers. Ref w3c/csswg-drafts#774 Fixes gh-4926 Closes gh-4930
Diffstat (limited to 'src/var')
-rw-r--r--src/var/rtrim.js6
-rw-r--r--src/var/whitespace.js2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/var/rtrim.js b/src/var/rtrim.js
new file mode 100644
index 000000000..89d86d17a
--- /dev/null
+++ b/src/var/rtrim.js
@@ -0,0 +1,6 @@
+import whitespace from "./whitespace.js";
+
+export default new RegExp(
+ "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
+ "g"
+);
diff --git a/src/var/whitespace.js b/src/var/whitespace.js
new file mode 100644
index 000000000..dcac814c7
--- /dev/null
+++ b/src/var/whitespace.js
@@ -0,0 +1,2 @@
+// https://www.w3.org/TR/css3-selectors/#whitespace
+export default "[\\x20\\t\\r\\n\\f]";