Deep @extend specificity problems #592

Closed
mgol opened this Issue Oct 29, 2014 · 7 comments

Comments

Projects
None yet
3 participants
@mgol

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

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol 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 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

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol 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 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

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol 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 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 from Deep extend loses selectors to Deep @extend specificity problems Oct 31, 2014

@mgol

This comment has been minimized.

Show comment
Hide comment

mgol commented Oct 31, 2014

Spec submitted: sass/sass-spec#115

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol 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!

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

Fix `@extend` specificity problems
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

Fix `@extend` specificity problems
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 mgreter added the Dev - WIP label Apr 2, 2015

@mgreter

This comment has been minimized.

Show comment
Hide comment
@mgreter

mgreter Apr 2, 2015

Contributor

This is directly related to #823

Contributor

mgreter commented Apr 2, 2015

This is directly related to #823

@mgreter mgreter added Dev - PR Ready and removed Dev - WIP labels Apr 2, 2015

mgreter added a commit to mgreter/libsass that referenced this issue Apr 2, 2015

@mgreter mgreter closed this in #1032 Apr 3, 2015

@mgreter mgreter removed the Dev - PR Ready label Apr 3, 2015

@xzyfer

This comment has been minimized.

Show comment
Hide comment
@xzyfer

xzyfer Apr 11, 2015

Contributor

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

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