Re: [csswg-drafts] [css-nesting] selecting grandparent selector with @nest (#6977)

The suggestions by @LeaVerou in #6330 are insightful yes, but maybe to much complex. To be clear, following behaviour in postcss was working even prior `noIsPseudoSelector`
```css
.a {
  color: blue;
  & .b {
    @nest :not(.c)& {
      color: red
    }
  }
}

.a {
  color: blue
}

.a:not(.c) .b {
      color: red
}
```

That why I though it was something that was part of the spec previously. Which is not the case, hence why I've created this issue. I think this syntax for selecting grandparent is less complex and it would benefit the spec.

There are a lot of cases where this might be useful, for example

```css
.ui-input {
  & input {
    @nest :not(.is-active)& {
      color: red
    }
  }
}

.ui-input:not(.is-active) input {
    color: red;
}
```

Once you are nested little deeper (for example in pseudo selector too), you have no simple way of accessing parent selector, for example component with different states.

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


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

Received on Sunday, 23 January 2022 09:17:49 UTC