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-selectors-4] Clarify the grammar of a functional pseudo-class #7016

Open
cdoublev opened this issue Feb 7, 2022 · 0 comments
Open

[css-selectors-4] Clarify the grammar of a functional pseudo-class #7016

cdoublev opened this issue Feb 7, 2022 · 0 comments

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Feb 7, 2022

https://drafts.csswg.org/selectors-4/#typedef-pseudo-element-selector

<pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'

<function-token> is a non-preserved token, therefore there will be no <function-token> when parsing <pseudo-class-selector>. However, CSS Values allows <function-token> <any-value> ')':

I am not sure why there would be a need to represent a functional notation like this rather than only with a prose saying that it represents a function component value, or with <function>, for example.

I see the flexibility to define a function with <function-token> <number> ')' to allow an arbitrary function name accepting <number> as its argument, for example, but the root problem described above remains.

This problem also exists with <general-enclosed>, defined with [<function-token> <any-value>? )] | (<any-value>?).

There is a related (but different) problem with <attribute-selector>, which includes '[' and ']' whereas it represents a simple block associated the corresponding token. They cannot be unquoted otherwise they would represents grouping combinators, but I think it would be usefull to add a note about this.

Selector grammars also use <ident-token> and <string-token> rather than the corresponding CSS type(s).

Selectors are parsed with parse something according to a CSS grammar, which matches the given grammar against component values, not tokens, which makes a difference for functions and simple blocks.

Edited after the changes in CSS Values that allow using <function-token> in value definitions.

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