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

@extend only applied to first element in @for loop when variable is used as a selector argument #1805

Closed
nathanielw opened this issue Dec 27, 2015 · 1 comment

Comments

@nathanielw
Copy link

Easier to show this one before explaining:

Code

%test {
 color: red; 
}

@for $i from 1 through 4 {
  *:nth-child(#{$i}) {
    @extend %test;
  }
}

Actual (libsass 3.3.2):

*:nth-child(1) {
  color: red;
}

Expected (as given by Ruby Sass):

*:nth-child(1), *:nth-child(2), *:nth-child(3), *:nth-child(4) {
  color: red;
}

If the variable is used as part of the selector (e.g. .item-#{$i} { ... }) this works fine, but it seems that if the variable is given as an argument to a pseudo-class, then libsass only applies the extension on the first iteration (I'm guessing it's trying to optimize, but only checks if variables are in the selector itself, not its arguments).

@xzyfer
Copy link
Contributor

xzyfer commented Dec 28, 2015

Thanks for the report @nathanielw. This is a duplicate of #1729 which has been fixed on master and will be 3.3.3.

Subscribe to #1808 for track the release of 3.3.3.

@xzyfer xzyfer closed this as completed Dec 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants