- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Wed, 10 Nov 2021 10:37:24 +0000
- To: public-css-archive@w3.org
After giving this a lot of thought over the last couple of weeks, I think I agree with @tabatkins' argument that we should strive to avoid nesting introducing a new level of indentation. 4 levels of nesting are very common for any medium sized stylesheet, and that would make them 8 with this kind of syntax. I also don't like solutions where symbols are used with a non-obvious meaning (e.g. the `&^` idea above). They are hard to remember and hard to google for. Repeating `@nest` over and over is a no-no, these nested selectors are very common and this would make stylesheets annoying to type and difficult to read. Therefore, I think the current syntax is the lesser of many evils, even though it has its own problems (two different syntaxes for no obvious (to authors) reason). Question: These selectors that can be written to resemble declarations, how commonly are they actually used? It's basically only element selectors, followed by pseudos, with the `&` somewhere after the first pseudo, right? Can we get any statistics on the prevalence of these in nested selectors? Are we designing syntax around a theoretical case that is never actually needed in practice? What if we ditch `@nest` and just make these selectors parse errors? Sure, it's a terrible experience if you craft a selector that ends up being a parse error for no discernible reason, but if these are so rare that only a tiny percentage of authors will ever stumble on one, it may be a reasonable price to pay for having a nice general syntax without the duality of `@nest` vs no `@nest`. It's all about which compromises we make, it's clear at this point that there is no solution here that doesn't involve compromises. While it would definitely be an ugly wart, I'm much more comfortable with one author having to do some digging to find this footnote because their weird selector didn't work than every author having to think "Do I use `@nest` here or not?" for every single nested selector they type. Of course it all depends on actual frequency of these selectors. I could contact the HTTPArchive folks and get some stats if this idea might be workable. -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4748#issuecomment-965002095 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 10 November 2021 10:37:26 UTC