[csswg-drafts] [selectors-4] [css-nesting-1] pseudo elements need to be clarified to correctly handle relative selectors. (#7979)

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

== [selectors-4] [css-nesting-1] pseudo elements need to be clarified to correctly handle relative selectors. ==
see : https://www.w3.org/TR/selectors-4/#issue-5830d0c1

> ISSUE 1 :  Pseudo-elements aren’t handled here, and should be.

> Relative selectors begin with a [combinator](https://w3c.github.io/csswg-drafts/selectors/#selector-combinator), with a selector representing the [anchor element](https://w3c.github.io/csswg-drafts/selectors/#relative-selector-anchor-elements) implied at the start of the selector. (If no combinator is present, the [descendant combinator](https://w3c.github.io/csswg-drafts/selectors/#descendant-combinator) is implied.)

Pseudo elements are not allowed in `:has` which so this issue didn't need to be resolved before : https://github.com/w3c/csswg-drafts/issues/7463

```css
/* ambiguous but invalid */
:has(::before) {}
```

With nesting you can now write :

```css
.foo {
  ::before {}
}
```

Is that (1) :

```css
.foo::before{}
```

or (2) :

```css
.foo ::before{}
```

I would say it is 1.
`::before` starts a new compound selector and has its own implicit "into pseudo tree" combinator as illustrated with `.foo::before:hover` vs. `.foo:hover::before`.

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


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

Received on Saturday, 29 October 2022 07:30:04 UTC