commit d40379890b12ffe0d65b5cf91072ce8c2969b3e6
parent b642f9ddc72894c4f73a6914e786e98d7aabc74a
Author: Ahmad Saleem <52317531+Ahmad-S792@users.noreply.github.com>
Date: Mon, 8 Dec 2025 12:28:48 +0000
Bug 2004370 [wpt PR 56519] - optional initial-value descriptor when registering Custom Properties, a=testonly
Automatic update from web-platform-tests
The initial-value descriptor when registering Custom Properties can be optional (#56519)
This is manual export of bugzilla fix - https://commits.webkit.org/303757@main
--
wpt-commits: 00141d836383bb80c0c7094704549794384029ac
wpt-pr: 56519
Diffstat:
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/css/css-properties-values-api/at-property-optional-initial-value.html b/testing/web-platform/tests/css/css-properties-values-api/at-property-optional-initial-value.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Properties and Values API: optional initial-value descriptor</title>
+<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api/#initial-value-descriptor">
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/9078">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+@property --registered {
+ syntax: '*';
+ initial-value: ;
+ inherits: false;
+}
+#target {
+ --test-bg: var(--registered) green;
+ --test-fallback: var(--registered, red);
+ background-color: var(--test-bg, var(--test-fallback));
+}
+</style>
+<div id="target"></div>
+<script>
+test(function() {
+ const target = document.getElementById('target');
+ const style = getComputedStyle(target);
+
+ // When initial-value is omitted (empty space), the property should be registered
+ // with a space character as the initial value, making var(--registered) green
+ // evaluate to " green" which is a valid color value.
+ assert_equals(style.backgroundColor, 'rgb(0, 128, 0)',
+ 'background-color should be green when @property has empty initial-value');
+ }, '@property with empty initial-value should use space character');
+</script>