-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Unexpected :extend()
behavior (with selector { selector {} }
nesting)
#1487
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
Comments
WorkaroundThe best workaround I've found is to force the issue, although this results in some ugly selectors. .class, .other { /* stuff */ }
.class, .extension {
.class, .other, .extension { /* more stuff */ }
}
.extension { &:extend(.class all); } .class,
.other,
.extension {
/* stuff */
}
.class .class,
.extension .class,
.class .other,
.extension .other,
.class .extension,
.extension .extension, /* ugly */
.extension .extension, /* ugly */
.extension .extension, /* ugly */
.extension .other,
.extension .extension {
/* more stuff */
} |
Its a bug |
Cool. Any plans to squash? If not, I could work on it—though I may need someone to point me in the right direction. |
@calvinjuarez sorry it took a while to reply - plans to squash it eventually, but we would love any help. I would
please let me know if you need any more help. my email address is my username, with dots around the a on the gmail domain. |
Does it mean that
should generate following 16 selectors?
Now it generates
|
In that case, yeah, I'd expect the 16. It may be verbose CSS, but it follows the expected behavior for LESS. |
So a minimal example for the issue would be: .class .class {/* stuff */}
.extension:extend(.class all) {} ^ should result in 4 selectors via combinatorial explosion (not 2 as it is now). Also referencing #1952 and #1641. In fact all these three issues are the same thing under the hood - and here's the key. |
What should be the combinatorial cap? Should anything over 2 just do global search/replace within the selector list? (This was what I was leaning towards.) Should any explosion be allowed? |
This I haven't yet figured out the math for n number of match combinations, but it should work in theory. I should be able to just refactor here: https://github.com/matthew-dean/less.js/blob/extend/lib/less/visitors/extend-visitor.js#L190-L191 But what I want to know is: should there be a limit? |
My Input
So this:
Current (1.4.1) Output
Currently compiles to this:
What I'd Expect
But it seems like the result should be this:
In other words, (almost) exactly like this compiles:
Questions
So,
The text was updated successfully, but these errors were encountered: