-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css] fix parsing of custom properties in @supports #82178
[css] fix parsing of custom properties in @supports #82178
Comments
(Experimental duplicate detection) |
Are you sure that starting with a comma is valid CSS? https://www.sassmeister.com/ also shows an error on the comma ( I know that SASS, but also understands CSS). |
Hello @aechan Yes, I am certain. Earlier versions of Safari on iOS erroneously counted it as invalid too, but that has since been fixed. You can feature detect that fix with this CSS I provided: @supports not (--validValue: , 0 0) {
.vscode-parsing-error {
content: "";
}
} Here are some resources on the validity of the valueI've quoted the relevant pieces in a human-readable order for your convenience: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties#Validity_and_values
https://drafts.csswg.org/css-variables/#invalid-variables
https://drafts.csswg.org/css-variables/#guaranteed-invalid
https://developer.mozilla.org/en-US/docs/Web/CSS/--*#Syntax
https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value
<bad-string-token>, <bad-url-token>, and <delim-token> are variations of code points, typically beginning with "U+": augmented-ui relies heavily on this to compose dynamic clip-path values if you would like a real world example: Thank you, |
@James0x57 Thanks for the pointers! |
@aeschli Could you please re-open this issue? Values of a custom property should not be parsed for commas - commas have no meaning in this context. Safari on iOS had the same issue and they've fixed it. SASS also has this issue but they only handle it incorrectly in the @supports statements now. The only work around is to disable the entire problem-checking feature in Visual Studio Code |
Here is a minimal JSBin using this feature of CSS in case it's useful to you: The leading comma allows for dynamic, optional, composition of comma separated standard properties. |
Great catch! The main thing is that CSS variables can be composed, so for example this is valid: .foo {
--a: anim;
--b: 1s ,;
--c: anim2 1s;
--d: , anim3 2s;
animation: var(--a) var(--b) var(--c) var(--d);
} and now |
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes, no extensions installed
The text was updated successfully, but these errors were encountered: