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

If comparison inconsistency between ruby and lib sass #1590

Closed
peterwilsoncc opened this issue Oct 8, 2015 · 4 comments
Closed

If comparison inconsistency between ruby and lib sass #1590

peterwilsoncc opened this issue Oct 8, 2015 · 4 comments

Comments

@peterwilsoncc
Copy link

It's very minor but a valid comparison in rubySass required refactoring for libSass.

rubySass: @if ( & == $sel ) {

libSass: @if ( "&" == $sel ) {

Full mixin follows:

@mixin last-child($sel: null){
    // for use with the miniselectivzr code in the polyfill JS
    // standard file uses :last-child psuedo class
    // IE file uses the u-last-child utility class
    @if ( "&" == $sel ) {
        @if ( true == $is_ie8_file ) {
            &.u-last-child {
                @content;
            }
        } @else {
            &:last-child {
                @content;
            }
        }
    }
    @else {
        @if ( true == $is_ie8_file ) {
            #{$sel}.u-last-child {
                @content;
            }
        } @else {
            #{$sel}:last-child {
                @content;
            }
        }
    }
}
@xzyfer
Copy link
Contributor

xzyfer commented Oct 8, 2015

Thanks for the report. Could you please provide a minimal snippet of Sass
code that exhibits this problem so we can debug it?
On 9 Oct 2015 8:51 am, "Peter Wilson" notifications@github.com wrote:

It's very minor but a valid comparison in rubySass required refactoring
for libSass.

rubySass: @if ( & == $sel ) {

libSass: @if ( "&" == $sel ) {

Full mixin follows:

@mixin last-child($sel: null){
// for use with the miniselectivzr code in the polyfill JS
// standard file uses :last-child psuedo class
// IE file uses the u-last-child utility class
@if ( "&" == $sel ) {
@if ( true == $is_ie8_file ) {
&.u-last-child {
@content;
}
} @else {
&:last-child {
@content;
}
}
}
@else {
@if ( true == $is_ie8_file ) {
#{$sel}.u-last-child {
@content;
}
} @else {
#{$sel}:last-child {
@content;
}
}
}
}


Reply to this email directly or view it on GitHub
#1590.

@saper
Copy link
Member

saper commented Oct 9, 2015

Simple test written sass/sass-spec#536

saper added a commit to saper/sass-spec that referenced this issue Oct 9, 2015
saper added a commit to saper/sass-spec that referenced this issue Oct 9, 2015
@saper
Copy link
Member

saper commented Oct 9, 2015

@peterwilsoncc I think that "&" in libsass does not expose the parent selector, it just compares strings. Can you confirm this is your case as well? See the test case and the expected output from Ruby Sass taken from saper/sass-spec@95053d9

@peterwilsoncc
Copy link
Author

Thanks @saper, very much appreciated.

@xzyfer xzyfer added this to the 3.3.1 milestone Oct 10, 2015
@mgreter mgreter modified the milestones: 3.3, 3.3.1 Oct 19, 2015
@mgreter mgreter self-assigned this Oct 19, 2015
xzyfer added a commit to xzyfer/sass-spec that referenced this issue Oct 20, 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

4 participants