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

Nested & will result strange line break with nested or extended style #1373

Closed
hail2u opened this issue Aug 17, 2014 · 8 comments
Closed

Nested & will result strange line break with nested or extended style #1373

hail2u opened this issue Aug 17, 2014 · 8 comments
Labels
bug Something isn't working

Comments

@hail2u
Copy link

hail2u commented Aug 17, 2014

If I write nested & like this:

.foo,
.bar,
.baz {
  .qux &:before {
    content: "test";
  }
}

I get:

.qux .foo:before, .qux
.bar:before, .qux
.baz:before {
  content: "test"; }

It should be:

.qux .foo:before,
.qux .bar:before,
.qux .baz:before {
  content: "test"; }

Tested on Sass 3.4.0.rc.3, ruby 2.0.0p353 (2013-11-22) [x64-mingw32].

@brian-hay
Copy link

Ditto here, another example:

.foo a,
.bar a {
  &:hover, &:focus {
    color: red;
  }
}

Results in:

.foo a:hover, .foo a:focus,
.bar a:hover,
.bar a:focus {
  color: red;
}

Note: Only the first 2 selectors in the rule are incorrectly on the single line.

Instead of:

.foo a:hover,
.foo a:focus,
.bar a:hover,
.bar a:focus {
  color: red;
}

@nex3
Copy link
Contributor

nex3 commented Aug 22, 2014

@brian-hay I'd expect that to produce

.foo a:hover, .foo a:focus,
.bar a:hover, .bar a:focus {
  color: red;
}

@nex3
Copy link
Contributor

nex3 commented Aug 22, 2014

This is definitely worth fixing, but at some point I plan to make parent-selector resolution use the same backend logic as @extend and I want to hold off on this until that's in place so as to avoid duplicating effort and logic.

@hail2u
Copy link
Author

hail2u commented Aug 23, 2014

Thanks for your clear response. I'm waiting for your fix!

@brian-hay
Copy link

@nex3 the SASS documentation doesn't seem to be clear on this but I personally I would have thought that for the ":expanded" style, it's more consistent to have each selector on it's own line (i.e. line break after comma), rather than grouping pseudo selectors.

@brian-hay
Copy link

@nex3 Disclosure: I work a lot with Drupal and its code style guidelines (and automated code review tools) demand one selector per line.

So, I'm happy to acknowledge my bias / self-interest :-)

Regardless I think one selector per line (always breaking at comma) is more consistent and easier to code because there are no special cases.

@nex3
Copy link
Contributor

nex3 commented Aug 23, 2014

I'd expect them all to be on different lines if &:hover, &:focus were on different lines. Given that they're not, though, it seems like the output should follow suit.

@nex3 nex3 added the bug Something isn't working label Aug 21, 2015
@nex3
Copy link
Contributor

nex3 commented Apr 5, 2018

I'm moving this issue to the new Ruby Sass repository because it's specific to Ruby Sass's implementation. Once it's there, I'm going to close it as "on ice" because Ruby Sass is deprecated and no additional features are planned for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants