Skip to content
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-variables] Invalid arbitrary substitution values as <declaration-value> #8771

Open
cdoublev opened this issue Apr 26, 2023 · 3 comments

Comments

@cdoublev
Copy link
Collaborator

Is it ok that Chrome/FF do not accept var(--custom, var(--)) at parse time? I would have rather said it is invalid at computed value time.

var() = var( <custom-property-name> , <declaration-value>? )

https://w3c.github.io/csswg-drafts/css-variables-2/#using-variables

The <declaration-value> production matches any sequence of one or more tokens, so long as the sequence does not contain <bad-string-token>, <bad-url-token>, unmatched <)-token>, <]-token>, or <}-token>, or top-level <semicolon-token> tokens or <delim-token> tokens with a value of "!". It represents the entirety of what a valid declaration can have as its value.

https://w3c.github.io/csswg-drafts/css-syntax-3/#any-value

I guess they are recursively looking all var() in the input list of component values and validate their arguments.

@andruud
Copy link
Member

andruud commented Apr 28, 2023

Variables does say:

In addition, if the value of a custom property contains a var() reference, the var() reference must be valid according to the specified var() grammar. If not, the custom property is invalid and must be ignored.

But it's indeed not clear if this is intended to mean "direct" var() only, or if the rule also applies to "inner" var()s.

@cdoublev
Copy link
Collaborator Author

Yeah, I briefly described the problem but I think the spec should say that any existing var() should be valid.

An invalid var() is a valid <declaration-value> but the authors (and implementers, I guess) want it to be invalid.

@tabatkins
Copy link
Member

Hm, indeed, I don't describe that well.

I don't think I had an intention in either direction, but thinking about it now, I do think it's good to validate the nested var()s, and luckily that's the interoperable behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants