-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Unexpected behavior of ampersand combinator (&
) within nested rules
#1575
Comments
No, not a bug.
While appending a full outer list would require you to repeat all of the parent selectors once again if |
Thanks for the reply and the recommendation to restate the class name to get the table rule to work. I certainly can do that; I was just looking for a way to not repeat myself. Can you explain the situation in which the current behavior is desirable more specifically? I'm having trouble following the explanation of the common design pattern you mention. |
Something like that:
Now you can switch between two color themes by assigning corresponding .theme-* class to some grandparent element (e.g. body). Of course both versions of the P.S. to correct myself: this feature is actually mentioned here: Parent-Selectors (it's not very easy to find though)... Either way you can always check SomMeri/less4j/wiki as it covers almost every LESS feature in details (for example: Appender). |
Oooh. That documentation you linked to looks very nice. Thank you. I agree that both forms make sense in general and have their potential uses. Is there a way I can request consideration of a new type of appender to support the expansion I originally expected |
You just did I guess, however I suspect you need to invent some more well-grounded and/or generalized use-case than your example above. You know... "Less is very conservative in adding syntax". |
@jacobcarpenter Maybe you could join the discussion in issue #1075 or simply add +1 if it would solve your problem. |
@SomMeri this looks exactly like what I was wanting. Thanks! |
Closing as duplicate of #1075. |
I'm running into unexpected behavior using the
&
combinator within nested rules.Here is a fragment of pseudo-html I'm attempting to style with less.
If I write:
as desired, I get:
That is, all elements with the
info
class havemargin-top
applied, plustable
elements with theinfo
class getwidth: 100%
.However, if I nest these rules within
details
, the ampersand (&
) combinator ceases to generate what I expect.I would expect
to turn into:
Instead, it turns into:
Is this a bug, or are my expectations flawed? Thanks!
The text was updated successfully, but these errors were encountered: