diff options
author | Anders Kaseorg <andersk@mit.edu> | 2022-09-19 14:08:12 -0700 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2022-09-19 23:20:14 +0200 |
commit | c0db6d70320ad6fb29a6a89aae3811a81b5adedf (patch) | |
tree | 5eb0abe4402077f45b87b2365a0e5e1dab6cb216 /test | |
parent | f14064cabf5e97ee9841cf3df9ec86bd7acaa9e6 (diff) | |
download | jquery-c0db6d70320ad6fb29a6a89aae3811a81b5adedf.tar.gz jquery-c0db6d70320ad6fb29a6a89aae3811a81b5adedf.zip |
CSS: Don’t trim whitespace of undefined custom property
Fixes gh-5105
Closes gh-5106
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
(cherry picked from commit ed306c0261ab63746040e5d58bb4477c3069a427)
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/css.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/unit/css.js b/test/unit/css.js index 2df877de8..fc7d4c3d4 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1760,6 +1760,7 @@ QUnit.test( "Do not throw on frame elements from css method (trac-15098)", funct " --prop10:\f\r\n\t val10 \f\r\n\t;\n" + " --prop11:\u000C\u000D\u000A\u0009\u0020val11\u0020\u0009\u000A\u000D\u000C;\n" + " --prop12:\u000Bval12\u000B;\n" + + " --empty:;\n" + " }\n" + "</style>" ); @@ -1768,7 +1769,7 @@ QUnit.test( "Do not throw on frame elements from css method (trac-15098)", funct $elem = jQuery( "<div>" ).addClass( "test__customProperties" ) .appendTo( "#qunit-fixture" ), webkitOrBlink = /\bsafari\b/i.test( navigator.userAgent ), - expected = 17; + expected = 19; if ( webkitOrBlink ) { expected -= 2; @@ -1814,6 +1815,8 @@ QUnit.test( "Do not throw on frame elements from css method (trac-15098)", funct assert.equal( $elem.css( "--prop10" ), "val10", "Multiple preceding and following escaped unicode whitespace trimmed" ); assert.equal( $elem.css( "--prop11" ), "val11", "Multiple preceding and following unicode whitespace trimmed" ); assert.equal( $elem.css( "--prop12" ), "\u000Bval12\u000B", "Multiple preceding and following non-CSS whitespace reserved" ); + assert.equal( $elem.css( "--empty" ), undefined ); + assert.equal( $elem.css( "--nonexistent" ), undefined ); } ); QUnit[ supportsCssVars ? "test" : "skip" ]( "Don't append px to CSS vars", function( assert ) { |