Skip to content
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

Deep @extend specificity problems #592

Closed
mgol opened this issue Oct 29, 2014 · 7 comments · Fixed by #1032
Closed

Deep @extend specificity problems #592

mgol opened this issue Oct 29, 2014 · 7 comments · Fixed by #1032

Comments

@mgol
Copy link

mgol commented Oct 29, 2014

The following SCSS input:

%a {
    &::-webkit-scrollbar {
        color: green;
    }
}
%b {
    @extend %a;
}

.a {
    .b {
        @extend %a;
    }

    .c {
        .b {
            @extend %b;
        }
    }
}

is compiled via Ruby Sass (3.4.5) to:

.a .c .b::-webkit-scrollbar, .a .b::-webkit-scrollbar {
  color: green; }

and via libsass (using node-sass 1.1.4) to:

.a .b::-webkit-scrollbar {
  color: green; }
@mgol
Copy link
Author

mgol commented Oct 29, 2014

BTW, what's interesting here is that if I just change ::-webkit-scrollbar in the source to, e.g., .d, Ruby Sass gives me:

.a .d.b {
  color: green; }

i.e. the same what libsass does. Weird.

EDIT: I submitted an issue to Ruby Sass about that: sass/sass#1495

@mgol
Copy link
Author

mgol commented Oct 30, 2014

I'll wait with submitting a PR to sass-spec until the Ruby Sass issue clarifies on what should really be happening.

@mgol
Copy link
Author

mgol commented Oct 31, 2014

As Sass maintainer indicated in sass/sass#1495 (comment), Sass is correct here due to pseudo-element low specificity. This is confirmed to be a libsass bug then.

I'll submit a spec.

mgol added a commit to mgol/sass-spec that referenced this issue Oct 31, 2014
@mgol mgol changed the title Deep extend loses selectors Deep @extend specificity problems Oct 31, 2014
@mgol
Copy link
Author

mgol commented Oct 31, 2014

Spec submitted: sass/sass-spec#115

@mgol
Copy link
Author

mgol commented Nov 3, 2014

This, BTW, is more serious than my other recent issues as it can change semantics in some cases. I wonder if a similar spec but with a class instead of a pseudo-selector shouldn't be added to show the difference between those two that libsass doesn't currently respect?

This is AFAIK one of the three issues that currently prevent our quite a large Sass code base from migrating to libsass (other two being @supports and @at-root support). The rest is mostly stylistic changes - a little annoying but nothing blocking.

Great job!

@mgreter mgreter added this to the 3.4 milestone Mar 9, 2015
@mgreter mgreter self-assigned this Apr 1, 2015
@mgreter mgreter modified the milestones: 3.2.1, 3.4 Apr 1, 2015
mgreter added a commit to mgreter/libsass that referenced this issue Apr 1, 2015
Fixes sass#592

Tried to implement specificity as per spec, but this
turned out not to work like ruby sass. Once I tweaked
the specificity constant of all types, it started to
work, but I don't know why ruby sass does it that way!
mgreter added a commit to mgreter/libsass that referenced this issue Apr 1, 2015
Fixes sass#592

Tried to implement specificity as per spec, but this
turned out not to work like ruby sass. Once I tweaked
the specificity constant of all types, it started to
work, but I don't know why ruby sass does it that way!
mgreter added a commit to mgreter/libsass that referenced this issue Apr 1, 2015
@mgreter
Copy link
Contributor

mgreter commented Apr 2, 2015

This is directly related to #823

mgreter added a commit to mgreter/libsass that referenced this issue Apr 2, 2015
@xzyfer
Copy link
Contributor

xzyfer commented Apr 11, 2015

Looks like this made it into 3.2.0. Updated the milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants