aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2022-01-03 07:28:49 -0500
committerGitHub <noreply@github.com>2022-01-03 13:28:49 +0100
commit655c0ed5e204b1f6427e09d615a49586a7bc84eb (patch)
tree5f0f0c10d3e5ba522e1c3b51fe481aba2fa3e64e
parent5f4d449aa836f376eab2d2ca7585d5476d12f095 (diff)
downloadjquery-655c0ed5e204b1f6427e09d615a49586a7bc84eb.tar.gz
jquery-655c0ed5e204b1f6427e09d615a49586a7bc84eb.zip
CSS: Justify use of rtrim on CSS property values
CSS does not acknowledge carriage return or form feed characters as whitespace but it does replace them with whitespace, making it acceptable to use `rtrim`. Closes gh-4956
-rw-r--r--src/css/curCSS.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/css/curCSS.js b/src/css/curCSS.js
index 6d8b6a2d3..15d624bbb 100644
--- a/src/css/curCSS.js
+++ b/src/css/curCSS.js
@@ -16,6 +16,12 @@ function curCSS( elem, name, computed ) {
// trim whitespace for custom property (issue gh-4926)
if ( isCustomProp ) {
+
+ // rtrim treats U+000D CARRIAGE RETURN and U+000C FORM FEED
+ // as whitespace while CSS does not, but this is not a problem
+ // because CSS preprocessing replaces them with U+000A LINE FEED
+ // (which *is* CSS whitespace)
+ // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
ret = ret.replace( rtrim, "$1" );
}