Re: [csswg-drafts] [css-nesting-1] nesting limited to conditional styling of the current element (another proposal) (#8166)

> There are a few small nits, like @layer is partly designed for handling the interactions of 'conditional styles for the same element', so it would be a mistake to exclude that from nested contexts.

I didn't consider this and you are right `@layer` is useful in this context.

I do however think it makes sense to limit the types of at rules.
I don't think it makes sense to nest at rules which declare globals like `@property`.

_Updated this in the proposal_

----

> That said, your proposal still allows basically any selector, since :is & :where are able to capture the relationships in category 4 - it's just opinionated about where those selectors live.

It does really enforce limits.
It would be impossible to match elements in a nested rule that weren't matched in the outer rule. 

That is why `&` can be omitted. There is no need to express the relationship between the outer and inner selector in this proposal.

```css
.foo {
  :is(.bar + .foo) {} /* can never match an element not matched by `.foo` */
}

.foo {
  :not(.foo) {} /* never matches anything */
}
```

Today this would be seen as a massive downside compared to nesting in preprocessors.
But I am curious how it would be perceived after having `@scope` in browsers for a few years.

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


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

Received on Thursday, 1 December 2022 17:41:20 UTC