Re: [csswg-drafts] [selectors-4] Allow more pseudo-classes following a pseudo-element (#7085)

It is clearer to me now, thanks. This issue is closed but has the "needs testcase" label, so I leave some suggestions below....

---

In [18. Grammar](https://drafts.csswg.org/selectors-4/#grammar), a whitespace should be forbidden between `<compound-selector>` and `<pseudo-compound-selector>`, and between `<pseudo-element-selector>` and `<pseudo-class-selector>`.

```diff
  White space is forbidden:
+ - Between <compound-selector> and <pseudo-compound-selector>.
+ - Between a <pseudo-element-selector> and a <pseudo-class-selector>.
  - [...]
```

Alternatively:

```diff
- White space is forbidden:
-   - [...]
+ White space is forbidden between any components of `<compound-selector>` or `<pseudo-compound-selector>`, 
+ except between `'['`, `<wq-name>`, `<attr-matcher>`, `<string-token>`, `<ident-token>`, `<attr-modifier>`, `']'`.
```

---

Pseudo-elements are forbidden in `:is()`, `:where()`, `:not()`, `:has()`, `:nth-*-child()`, either in prose or with syntax, which is inconsist. 

I suggest to define that `:is()` and `:where()` should take `<forgiving-real-selector-list>` as a list of `<complex-real-selector>`, and `:not()` should take `<real-selector-list>`. This would also allow to clarify the grammar of `:current()`, for which it is not clear whether pseudo-elements are allowed or not (I assume they are not).

```diff
- The matches-any pseudo-class, :is(), is a functional pseudo-class taking a <forgiving-selector-list> as its sole argument.
+ The matches-any pseudo-class, :is(), is a functional pseudo-class taking a <forgiving-real-selector-list> as its sole argument.
```

```diff
- The negation pseudo-class, :not(), is a functional pseudo-class taking a selector list as an argument.
+ The negation pseudo-class, :not(), is a functional pseudo-class taking a <real-selector-list> as an argument.
```

```diff
- Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is().
```

```diff
- Pseudo-elements cannot be represented by the negation pseudo-class; they are not valid within :not().
```

```diff
- 1. Parse a list of <complex-selector>s from input, and let selector list be the result.
+ 1. Parse a list of <complex-real-selector>s from input, and let selector list be the result.
```

```diff
+ <real-selector-list> = <complex-real-selector-list>
```

---

The argument of logical combination pseudo-classes following a pseudo-element should be restricted to the same set of pseudo-classes allowed to follow the pseudo-element. For example, `::before:is(type)` shoud be invalid, but I do not think there is a normative definition for this.

```diff
- Note: The logical combination pseudo-classes pass any restrictions on validity of pseudo-classes to their arguments.
+ Note: The logical combination pseudo-class arguments are restricted to the pseudo-classes that are allowed to follow the pseudo-element.
```

-- 
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7085#issuecomment-1345901742 using your GitHub account


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

Received on Monday, 12 December 2022 05:23:15 UTC