Nice to have `&&` references parent's parent
See original GitHub issueI’m writing code where I want to store a component’s state as a bem modifier on the container. Right now I can’t use the new &--...
nested with &-...
to do so. Therefore I propose to add a double ampersand to reference the parent’s parent, and perhaps &(n)
to continue upward traversal.
Example:
.Block {
&-element { … }
&--modifier {
&&-element { … }
}
}
would compile to
.Block-element { … }
.Block--modifier .Block-element { … }
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top Results From Across the Web
Do You Give Parent References? — Taking Care of Business
Have you ever been asked to give references by parents looking for a family child care provider?It's not that common for parents to...
Read more >Should you put your father as a reference if you worked for his ...
References should at least appear to be unbiased. Choose someone else, preferably your immediate supervisor or someone well-acquainted with your work.
Read more >No, you cannot use your mother as a professional reference!
No, you cannot use your mother as a professional reference !
Read more >Character Reference Letter for Court: Child Custody Template
A character reference letter gives the judge insight into the case by offering a third party's perspective on the parent's relationship with the...
Read more >Is it bad to put your parents as references, even if they ... - Reddit
In general, using relatives/significant others is going to look bad since it's not as if a potential employer expects your parents to give...
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 already offers the ability to do what you’re asking.
Understanding the
&
is a difficult concept for a lot of people (a lot of novices mistakenly believe that it only references the previous level of nesting rather than the entire resolved selector). Adding a double ampersand would only further confuse novices.Your second suggestion makes absolutely no sense and would be a backwards incompatible change for users who already use the parent selector in its current form.
Apparently I misunderstood what
&
is used for. On the other hand it looks like the current behavior of sass is counterintuitive. If&
references the root parent, then it seems like the intuitive behavior would be this:would compile to:
instead of the current: