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

Disallow parent selectors in selector-append #2760

Merged
merged 2 commits into from
Nov 25, 2018
Merged

Conversation

glebm
Copy link
Contributor

@glebm glebm commented Nov 24, 2018

Now correctly errors on inputs such as this one instead of crashing (see #2663):

div {
  a: selector-append('.menu', 'li', '&');
}
Error: Parent selectors aren't allowed here.
        on line 3:37 of ../../../tmp/test.scss, in function `selector-append`
        from line 3:6 of ../../../tmp/test.scss
>>   e: selector-append('.menu', 'li', '&');

   ------------------------------------^

Now correctly errors on inputs such as this one (see sass#2663):

    div {
      a: selector-append('.menu', 'li', '&');
    }
@nschonni
Copy link
Collaborator

Might need a PR to sass-spec for this one. I'm guessing there are already tests that are just disabled if this error wasn't supported before that need to be enabled

@glebm
Copy link
Contributor Author

glebm commented Nov 25, 2018

No disabled tests get fixed by this so I guess a libsass-closed-issues test should be added to sass-spec.

@xzyfer
Copy link
Contributor

xzyfer commented Nov 25, 2018

There isn't a sass-spec because there wasn't a reported issue. We were producing an error in this case, but not the right error

Error: $selectors: "&" is not a valid selector: Invalid CSS after "": expected selector, was "&" for `selector-append'
        on line 2 of test.scss
  Use --trace for backtrace

The SEGV from #2663 is a known issue with reparsing selector during eval. I've previously created the selector-validation tag for related issues. The fix for that is a fairly significant refactor.

@xzyfer xzyfer merged commit c93f058 into sass:master Nov 25, 2018
@glebm
Copy link
Contributor Author

glebm commented Nov 25, 2018

We were producing an error in this case, but not the right error

We weren't producing an error, we were segfaulting instead:

sassc/bin/sassc ~/tmp/test.scss 
[1]    6924 segmentation fault (core dumped)  sassc/bin/sassc ~/tmp/test.scss

@glebm glebm deleted the fix-parent branch November 25, 2018 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants