- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Fri, 02 Dec 2022 23:10:27 +0000
- To: public-css-archive@w3.org
No, CSS as a whole does not meet the full needs. The purpose of nesting, the reason it exists in preprocessors, is that it reduces repetition when you're writing a bunch of selectors that elaborate on a base selector. Exactly what that elaboration is doesn't matter; the point is that in all scenarios, you have some base selector, and you're adding more stuff to it. As already mentioned, @scope is not sufficient for this. You can use it for *some* uses, but only ones where the target elements are the same as the parent elements or descendants of them. This restriction makes sense *when you're trying to define a styled component*; that's a semantically meaningful thing, and intrinsically carries a notion of containment. But when you're not trying to do that, just trying to write some selectors without repeating yourself a bunch, it's an odd restriction. @custom-selector isn't sufficient for this, either. In theory it has all the necessary functionality, but it doesn't have the right *shape*. Custom selectors *also* carry semantic meaning - they have a unique-across-the-whole-page name, they live separately from any particular rule, etc. Using them instead of Nesting would be *incredibly* awkward - I request that you attempt to convert any non-trivial real-world usage of Nesting into using @custom-selector, and see how far you get before you start just using junk names, especially for the second or third level of nesting in a rule. ^_^ -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8166#issuecomment-1335948444 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 2 December 2022 23:10:29 UTC