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

selector-nest produces duplicates if parent selector consists of multiple parts #2640

Closed
Feuerfuchs opened this issue Apr 26, 2018 · 3 comments

Comments

@Feuerfuchs
Copy link

Feuerfuchs commented Apr 26, 2018

To trigger this bug, just use a selector that consists of multiple parts (so something like .class1, .class2) as first argument for selector-nest. The function will act as if the parent selector contained all parts twice, and so the result consists of duplicates.

input.scss

.theme1, .theme2 {
  .something {
    /* nothing */
  }
}

$sel: selector-nest('.theme1, .theme2', '.something');
  
#{$sel} {
  /* nothing */
}

Actual results

libsass 3.5.4

.theme1 .something, .theme2 .something {
  /* nothing */
}

.theme1 .something, .theme2 .something, .theme1 .something, .theme2 .something {
  /* nothing */
}

Expected result

ruby sass 3.4.25

.theme1 .something, .theme2 .something {
  /* nothing */
}

.theme1 .something, .theme2 .something {
  /* nothing */
}

version info:

$ node-sass --version
node-sass       4.9.0   (Wrapper)       [JavaScript]
libsass         3.5.4   (Sass Compiler) [C/C++]
@Feuerfuchs Feuerfuchs changed the title selector-nest duplicates selector if it consists of multiple parts selector-nest produces duplicates if parent selector consists of multiple parts Apr 26, 2018
@glebm
Copy link
Contributor

glebm commented Nov 26, 2018

I'm not sure what fixed this but it is no longer broken on master:

$ sassc/bin/sassc ~/tmp/nest.scss
.theme1 .something, .theme2 .something {
  /* nothing */ }

.theme1 .something, .theme2 .something {
  /* nothing */ }

@xzyfer
Copy link
Contributor

xzyfer commented Nov 27, 2018

Spec added sass/sass-spec#1314

@xzyfer
Copy link
Contributor

xzyfer commented Nov 27, 2018

Test pass!

@xzyfer xzyfer closed this as completed Nov 27, 2018
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