3 ms·
Looks useful to me in order to accommodate parent modifiers classes. .button { @nest div.small-print & { a { @nest :not(nav) & { Including the body: .button
by dieulot 4y ago
Looks useful to me in order to accommodate parent modifiers classes.
.button { @nest div.small-print & {
a { @nest :not(nav) & {
Including the body:
.button { @nest body.has-js & {
- eurasiantiger 4y agoThis is a flawed approach and leads to N:M combinatorial explosion in stylesheets. Sure, it’s convenient to have component styles react to the context they’re in, but CSS Custom Properties are a much better solution for that.
- chrismorgan 4y ago> a { @nest :not(nav) & { FYI, this `:not(nav) a` doesn’t do what you almost certainly intended. It doesn’t match “an <a> that is not inside a <nav>”, but rather “an <a> that has at least one ancestor that is not a <nav>”. You can’t currently express what you wanted there; the best you can generally manage is if you can anchor it with a parent selector, e.g. `:not(nav) > a`, which will match any <a> whose immediate parent is not a <nav>. I can imagine something along the lines of `a:not(:has(nav :scope))` working in the future too.