-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-nesting] wording &&
"silly", but useful
#9113
Comments
While this way of handling specificity is very useful ATM, I'm not sure it should be promoted in any way in the specs. Two reasons:
|
Interesting. Some comments: The parent selector SASS at the least doesn't support I'm not too familiar with layers and they look interesting. But it appears they cannot be used to override any styles outside of a layer, eg from MDN: "…any styles declared outside of a layer will override styles declared in a layer, regardless of specificity". One of the primary use cases I've had for this technique is to override specificity set in other people's code, which I can't touch. If I can |
Yup, specificity hacks can be useful, but aren't recommended in the future. |
Reasonable. I see that there is an issue for supporting that referenced from the spec, but it is marked as closed. Is something still planned for supporting this? |
Not sure if this is the place to bring this up, but: In the CSS Nesting spec example 5, there is an example showing a nested
&&
, describing it as "Again, silly, but can even be doubled up." The unnested equivalent of that example is:It seems less silly when considering that the
.foo.foo
has double the specificity (0-2-0) of the.foo
selector (0-1-0). That is a somewhat common technique of increasing specificity without changing anything of the "query" of the selector. Being able to chain the&
in a nested selector makes it less verbose and easier to manage this technique, and it might be worth noting this to make it more apparent, or at least dropping the "silly" bit.The text was updated successfully, but these errors were encountered: