Prepending a selector using @at-root fails with multiple parent selectors
See original GitHub issueNot sure if this is intended, but would prefer @at-root
be applied to each parent selector:
SCSS
.parent {
&:hover,
&:focus,
&:active {
.child {
@at-root .ROOT#{&} {
content: 'Only the first selector gets “.ROOT” instead of all of them';
}
}
}
}
CSS
.ROOT.parent:hover .child,
.parent:focus .child,
.parent:active .child {
content: 'Only the first selector gets “.ROOT” instead of all of them';
}
http://www.sassmeister.com/gist/f5b5db378086086f047570700621b506
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
Ampersand (parent selector) inside nested selectors [duplicate]
Unfortunately, it's not currently possible in SASS (or any other CSS preprocessor I know of). Share.
Read more >Parent Selector - Sass
When a parent selector is used in an inner selector, it's replaced with the corresponding outer selector. This happens instead of the normal...
Read more >Features In-Depth | Less.js
It can be useful to prepend a selector to the inherited (parent) selectors. This can be done by putting the & after current...
Read more >The Sass Ampersand - CSS-Tricks
The & always refers to the parent selector when nesting. Think of the & as being removed and replaced with the parent selector....
Read more >Parent Reference - CSS PREprocessors
Selector prepend. Appending selectors might work when you are appending a class, id, or attribute selector, but what if we need to add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sass provides functions for working with selectors. Use this instead:
@bichotll - I think you’d have to have some code that applies to these selectors except the .ROOT
I for one am ecstatic to have found that this exists 😃 Looking forward to playing with it.