🌐 AI搜索 & 代理 主页
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/css/curCSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function curCSS( elem, name, computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ];

// trim whitespace for custom property (issue gh-4926)
if ( isCustomProp ) {
if ( isCustomProp && ret !== undefined ) {

// rtrim treats U+000D CARRIAGE RETURN and U+000C FORM FEED
// as whitespace while CSS does not, but this is not a problem
Expand Down
5 changes: 4 additions & 1 deletion test/unit/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>"
);
Expand All @@ -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;
Expand Down Expand Up @@ -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 ) {
Expand Down