WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
276223
The `initial-value` descriptor when registering Custom Properties can be optional
https://bugs.webkit.org/show_bug.cgi?id=276223
Summary
The `initial-value` descriptor when registering Custom Properties can be opti...
Bramus
Reported
2024-07-04 04:28:19 PDT
# Demo The following page uses a CSS Space Toggle to color the page green or red. It should color the page green when the engine used has `@property` support and red when the engine used does not support `@property`. URL:
https://codepen.io/bramus/pen/bGjQVEm
Code: ```css @property --registered { syntax: '*'; initial-value: ; inherits: false; } body { --bg-when-supported: var(--registered) green; --bg-when-not-supported: var(--registered, red); background: var(--bg-when-supported, var(--bg-when-not-supported)); } ``` # Results Actual Result: The page colors red in Safari Expected Result: The page colors green in Safari Other browsers: The page colors green in Chrome 119+ [^1] and Firefox Nightly. # The problem WebKit seems to ignore this part of the spec [^2]
> If the value of the syntax descriptor is the universal syntax definition, then the initial-value descriptor is optional. If omitted, the initial value of the property is the guaranteed-invalid value.
[^1]: This commit enabled that:
https://chromium-review.googlesource.com/c/chromium/src/+/4890262
[^2]:
https://drafts.css-houdini.org/css-properties-values-api/#initial-value-descriptor
Attachments
rendering in safari, firefox, chrome
(2.68 MB, image/png)
2024-07-07 23:40 PDT
,
Karl Dubost
no flags
Details
Reference Screenshot (Patched Minibrowser - WebKit ToT (296257@main))
(743.66 KB, image/png)
2025-06-16 00:36 PDT
,
Ahmad Saleem
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Karl Dubost
Comment 1
2024-07-07 23:40:44 PDT
Created
attachment 471833
[details]
rendering in safari, firefox, chrome
Radar WebKit Bug Importer
Comment 2
2024-07-07 23:41:13 PDT
<
rdar://problem/131288198
>
Karl Dubost
Comment 3
2024-07-07 23:42:01 PDT
tested in Safari Technology Preview 198 20619.1.20.7 Firefox Nightly 129.0a1 12924.7.4 Google Chrome Canary 128.0.6582.0 6582.0
Ahmad Saleem
Comment 4
2025-06-16 00:35:28 PDT
In Source/WebCore/css/parser/CSSVariableParser.cpp: From 'CSSVariableParser::parseDeclarationValue' & 'CSSVariableParser::parseInitialValueForUniversalSyntax' functions, removing this bit - fixes the test cases but WPT test - which was added by Blink / Chromium, Safari Technology Preview 221 is already passing, so we are missing coverage here since codepen demo is failing yet WPT is passing: if (range.atEnd()) return nullptr; ^ Remove this from both functions and we pass this codepen demo.
Ahmad Saleem
Comment 5
2025-06-16 00:36:39 PDT
Created
attachment 475577
[details]
Reference Screenshot (Patched Minibrowser - WebKit ToT (
296257@main
))
Ahmad Saleem
Comment 6
2025-06-16 00:40:39 PDT
With patch, there is no failure or change in result on synced WPT in WebKit repo for `css-variables` and `css-properties-values-api` directories. So no progression or regression.
Ahmad Saleem
Comment 7
2025-06-18 05:20:22 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/46899
EWS
Comment 8
2025-12-02 08:16:01 PST
Committed
303757@main
(2cecd19a550c): <
https://commits.webkit.org/303757@main
> Reviewed commits have been landed. Closing PR #46899 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug