- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Wed, 21 Dec 2022 23:01:59 +0000
- To: public-css-archive@w3.org
tabatkins has just created a new issue for https://github.com/w3c/csswg-drafts: == [selectors-4] Allow * before a type selector == I was gonna wait to propose this until after the Nesting issue resolved, but I think it might be useful to bring up earlier now. The restriction currently imposed by the Nesting spec is that you can't start your selector with an ident. If your selector is a descendant-combinator relative selector, this is easy to fix - rather than `div {...}` write `& div {...}`. But if you're adding context to your parent rule, like `div & {...}`, the fix isn't as easy - you have to write `:is(div) & {...}` to trigger the correct parsing. On Twitter, [Brandon McConnell](https://twitter.com/branmcconnell/status/1604893779747819520) suggested an easy fix - you can currently prepend a `*` to any compound selector for absolutely no effect, *unless* the compound selector contains a type selector. That is, `.foo` and `*.foo` are precisely identical in behavior, but `*div` is currently invalid. (Effectively, `*` is a wildcard type selector right now.) Brandon suggests making that valid, so you can add a `*` to *any* compound selector. Then the easiest fix for any nested selector that starts with an ident is to just put a `*` at the front of it. `div {...}` can become `*div {...}`, `div & {...}` can become `*div & {...}`, etc. And putting a `*` in front of anything else is *already* valid and doesn't change the meaning, so this works well as a generic "just spam it if you want to be safe" technique, if people don't want to learn the rule. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8253 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 21 December 2022 23:02:01 UTC