[csswg-drafts] [css-nesting-1] Allow relative selector syntax in `@nest` rules. (#7854)

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

== [css-nesting-1] Allow relative selector syntax in `@nest` rules. ==
This is an alternative proposal to : https://github.com/w3c/csswg-drafts/issues/7834

It only focusses on a single part of the issues brought up there:

> selectors within nested context are incompatible with those outside of nested context, and with syntax within `@scope`, which invites a lot of copy-paste errors when transferring code among these contexts

------

Only nested selectors with a single `&` and if the `&` is located at the start of the selector would currently qualify for this (correct me if I am wrong).

Yes :

- `&.foo`
- `& .foo`
- `& + .foo`
- `& .foo + .bar`
- ...

No :

- `.foo&`
- `.foo &`
- `& + &`
- `& + .bar ~ &`

------

Can we allow relative selector syntax only in `@nest` in the current nesting syntax?

```css
.foo {
  @nest .bar {
    /* & .bar */
    /* .foo .bar */
  }
}
```

```css
.foo {
  @nest > .bar {
    /* & > .bar */
    /* .foo > .bar */
  }
}
```

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


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

Received on Friday, 7 October 2022 17:39:02 UTC