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

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors-4] Clarify the grammar of a functional pseudo-class ==
A (list of) selector is parsed with *parse something according to a CSS grammar*:

> Selectors are [parsed](https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar) according to the following grammar:
> - `<selector-list> = <complex-selector-list>`
> - [...]
> - `<pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'`

With `:not(.class)` as the input, *parse something according to a CSS grammar* normalizes the input then runs *parse a list of component values*, which runs *consume a component value*, which runs *consume a function*, which creates a function component value when reading the `<function-token>` with value `not`, consumes `)`, consumes the following tokens as the (arguments) value of the function component value, and returns the function component value after reading `)`.

`:not(.class)` would be consumed to the component value eg. `{ name: 'not', value: [{ type: 'ident-token', value: 'class' }] }`. Therefore there will be no `<function-token>` when matching `<pseudo-class-selector>` (the production for a functional pseudo-class, I think). 

> The syntax of a pseudo-class consists of a ":" (U+003A COLON) followed by the name of the pseudo-class as a CSS identifier, and, in the case of a functional pseudo-class, a pair of parentheses containing its arguments.

I think `<pseudo-class-selector>` could be defined in prose instead, and its definition could re-use the wording for [`<url-modifier>`](https://drafts.csswg.org/css-values-4/#url-modifiers), which refers to the definition of *a functional notation: **a type of component value***:

> The syntax of a pseudo-class consists of a ":" (U+003A COLON) followed by the name of the pseudo-class as an [`<ident>`](https://drafts.csswg.org/css-values-4/#typedef-ident), or in the case of a functional pseudo-class, by a [functional notation](https://drafts.csswg.org/css-values-4/#functional-notation).

The [type definition of `<pseudo-class-selector>`](https://drafts.csswg.org/selectors/#typedef-pseudo-class-selector) in `17. Grammar` would be anchored to this prose in [3.5 Pseudo-classes](https://drafts.csswg.org/selectors/#pseudo-classes).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7016 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 7 February 2022 07:45:38 UTC