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

I’ve tested several approaches in the past:

- 1a: [Test for nesting support by actually nesting](https://codepen.io/bramus/pen/oNdrypM)
- 1b: [Test for nesting support by actually nesting + a space toggle](https://codepen.io/bramus/pen/LYmKBEq) for developer convenience.
- 2: [Test for nesting support by testing for `selector(&)` support](https://codepen.io/bramus/pen/XWqLOaR)

The caveat with approach 2 is that it assumes a browser does not ship `&` as a selector without shipping nesting. IIRC @tabatkins mentioned somewhere _(can’t seem to find back where)_ that `&` should not ship separately, so it’s safe to rely on it.

In practice, though, I don’t think authors will test nesting, as they’ll simply see the nested styles not get applied in that case:
- Build a base style layer that doesn’t use nesting
- Layer nested styles on top

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


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

Received on Monday, 6 February 2023 21:46:09 UTC