Re: [csswg-drafts] [css-nesting-1][css-cascade-6] Should/can relative selectors be allowed un-nested (#12418)

If we don't allow them generally, I think it would be strange to allow them when the same file is imported with a scope modifier. That would make the syntax conditionally valid depending how the file is imported. My preference would be to have the same rules in both cases. 

Notably, if we disallow, authors can still achieve the same impact explicitly:

```css
:scope > h2 { … }
```

As you noted in the other issue, when `:scope` is the root `html` element, both child and sibling combinators become basically useless. So this might only match when the stylesheet is scoped – but it would be valid and clear about the intent of the selector in both cases. 

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


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

Received on Monday, 30 June 2025 19:50:42 UTC