Re: [csswg-drafts] [css-conditional-5][css-nesting-1] Feature detection for nesting (#8399)

I agree that authors will likely not write single stylesheets with both nested and un-nested versions of selectors. They'll either, as you say, write the stylesheet without nesting until they no longer care about older browsers, or use a preprocessor and let it emit the un-nested version.

However, what's reasonable, and should be encouraged, would be:
```css
@import "nested-and-small.css" supports(selector(&));
@import "not-nested-and-large.css" not supports(selector(&));
```
(or ideally do the equivalent in <link> tags)

This way the author can use a preprocessor to generate the larger, un-nested stylesheet, but the user of a newer browser doesn't have to pay the download cost.

While nesting should be detectable via script, we need to be able to feature detect it without script (or UA sniffing) as well.

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


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

Received on Sunday, 5 February 2023 02:47:38 UTC