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

bug with & (parent-selector) and @each directive in 3.3.2 #1757

Closed
lunelson opened this issue Nov 25, 2015 · 6 comments
Closed

bug with & (parent-selector) and @each directive in 3.3.2 #1757

lunelson opened this issue Nov 25, 2015 · 6 comments

Comments

@lunelson
Copy link

-- edit --
The following regression has been identified by @xzyfer as having to do with the @each directive. Current workaround is to use a @for loop instead.

@function last-sels() {
  $out: ();
  @each $list in & {
    $last: nth($list, length($list));
    @if not index($out, $last) {
      $out: append($out, $last, 'comma');
    }
  }
  @return $out;
}

.test .nest {
  content: inspect(last-sels());
}

.test, .other {
  content: inspect(last-sels());
}

resulted in this in 3.2.5

.test .nest {
  content: (.nest,);
}

.test, .other {
  content: .test, .other;
}

but in 3.3.2 does this

.test .nest {
  content: .test .nest;
}

.test, .other {
  content: .other;
}
@xzyfer
Copy link
Contributor

xzyfer commented Dec 1, 2015

This appears to be a bug with @each and &. The following changes fixes your issue.

-  @each $list in & {
+  @for $i from 1 through length(&) {
+    $list: nth(&, $i);

@lunelson
Copy link
Author

lunelson commented Dec 1, 2015

ah good catch! I can work with that, shall I update the title of this issue?

xzyfer added a commit to xzyfer/sass-spec that referenced this issue Dec 1, 2015
@xzyfer
Copy link
Contributor

xzyfer commented Dec 1, 2015

Yea please.

@xzyfer
Copy link
Contributor

xzyfer commented Dec 1, 2015

Spec added sass/sass-spec#637

@xzyfer
Copy link
Contributor

xzyfer commented Dec 1, 2015

Added to the 3.4 milestone since there is a viable workaround.

@lunelson lunelson changed the title parent selector-list operations returning wrong result in 3.3.2 bug with & (parent-selector) and @each directive in 3.3.2 Dec 1, 2015
@jakob-e
Copy link

jakob-e commented Dec 7, 2015

deleted

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

4 participants