-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Compound selectors and @extend behavior change since 3.2.7 #878
Comments
This is a real bug. The mixins are not required to reproduce it: %alpha { alpha: "hello"; }
%omega:after {
@extend %alpha;
omega: "world";
}
.alpha-omega-1 {
@extend %alpha;
@extend %omega;
}
.alpha-omega-2 {
@extend %alpha;
@extend %omega;
} Produces: .alpha-omega-1, .alpha-omega-2 {
alpha: "hello"; }
.alpha-omega-1:after, .alpha-omega-2:after {
omega: "world"; } But should produce: .alpha-omega-1, .alpha-omega-2,
.alpha-omega-1:after, .alpha-omega-2:after { alpha: "hello"; }
.alpha-omega-1:after, .alpha-omega-2:after { omega: "world"; } Note that %alpha { alpha: "hello"; }
%omega a {
@extend %alpha;
omega: "world";
}
.alpha-omega-1 {
@extend %alpha;
@extend %omega;
}
.alpha-omega-2 {
@extend %alpha;
@extend %omega;
} produces .alpha-omega-1 a, .alpha-omega-2 a, .alpha-omega-1, .alpha-omega-2 {
alpha: "hello"; }
.alpha-omega-1 a, .alpha-omega-2 a {
omega: "world"; } as expected. But even a class attached to the main placeholder is failing: %alpha { alpha: "hello"; }
%omega.foo {
@extend %alpha;
omega: "world";
}
.alpha-omega-1 {
@extend %alpha;
@extend %omega;
}
.alpha-omega-2 {
@extend %alpha;
@extend %omega;
} |
Ah, I see. I didn't thoroughly test it ( without the So the core of the issue is compound selectors ( pseudo-classes, actual classes ) not extending properly. I'll edit the issue slightly to correct it. |
This is a weird case. In general, it would be correct to remove the pseudo-selector in this case -- Where it starts to get weird is that It gets even weirder, though. Although |
I see, so once the bug is fixed, in addition to parsing While I can understand your desire to maintain compatibility to the spec ( and it's own backwards compatibility ), in the interest of simplicity perhaps only allowing |
It's not too difficult to add special cases for the backwards-compatible selectors. |
Cool beans 👍 just wanted to mention; you guys are doing an awesome job. I haven't worked with Ruby much, but I'm working on changing that. Looking forward to helping the cause in the future :-) |
This worked on 3.2.7, but since 3.2.8 through 3.2.10, it behaves differently. ( I didn't actually test 3.2.9 )
The expected result is:
But the actual result is:
Note that the
:after
selectors aren't extended to include thealpha: "hello";
property. Of course, I could just@include alpha
in the omega@mixin
, however that changes the grouping; and besides, this should work so far as I can tell.I don't know what your position is on the correct behavior here, so perhaps this is behaving expectedly, but I can't imagine that it is.
Just to clarify, the reason for both the
@mixin
and%rule
is I use the%rule
in the current media scope, and redefine it using the@mixin
in different media scopes.The text was updated successfully, but these errors were encountered: