diff --git a/test/unit/css.js b/test/unit/css.js
index <HASH>..<HASH> 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -1558,10 +1558,12 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(
 
 ( function() {
 	var supportsCssVars,
-		div = jQuery( "<div>" ).appendTo( "#qunit-fixture" )[ 0 ];
+		elem = jQuery( "<div>" ).appendTo( document.body ),
+		div = elem[ 0 ];
 
 	div.style.setProperty( "--prop", "value" );
-	supportsCssVars = getComputedStyle( div ).getPropertyValue( "--prop" );
+	supportsCssVars = !!getComputedStyle( div ).getPropertyValue( "--prop" );
+	elem.remove();
 
 	QUnit[ supportsCssVars ? "test" : "skip" ]( "css(--customProperty)", function( assert ) {
 		jQuery( "#qunit-fixture" ).append(
Tests: Clean up after the CSS Custom Properties support test

Ref bcec<I>ee<I>e2d0e<I>bcb<I>e3d<I>a8f<I>f9
Ref <I>bf<I>d5b<I>f<I>dbc<I>b<I>f1c5a<I>