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

Error with & selector interpolation in @at-root blocks #1043

Closed
stol opened this issue Apr 3, 2015 · 16 comments
Closed

Error with & selector interpolation in @at-root blocks #1043

stol opened this issue Apr 3, 2015 · 16 comments

Comments

@stol
Copy link

stol commented Apr 3, 2015

Hello,

I have a different behaviour with & parent selector, between sass and libsass

.component{
    color: red;
    @at-root{
        #{&}--foo#{&}--bar {
            color: blue;
        }
    }
}

.test{
        .selector#{&} {
            color: blue;
        }
}

// libsass 3.4.0-beta.4 outputs:

.component {
  color: red; }
  .component--foo.component--bar {
    color: blue; }

.test .selector.test {
  color: blue; }

// Ruby sass outputs:

.component {
  color: red; }
  .component .component--foo.component--bar {
    color: blue; }

.test .selector.test {
  color: blue; }

It works correctly when the interpolation is not inside @at-root blocks!

Thank you !

@mgreter mgreter changed the title parent "&" selector error when directy next to something Error with & selector interpolation in @at-root blocks Apr 3, 2015
@xzyfer xzyfer self-assigned this Apr 4, 2015
@ekskimn
Copy link

ekskimn commented Apr 11, 2015

@xzyfer I don't think I have the rights to assign this issue to myself....would you mind assigning it to me?

@xzyfer xzyfer removed their assignment Apr 11, 2015
@xzyfer
Copy link
Contributor

xzyfer commented Apr 11, 2015

@ekskimn looks like issues can only be assigned to core members

@ekskimn
Copy link

ekskimn commented Apr 11, 2015

@xzyfer ah, got it =)

@mgreter
Copy link
Contributor

mgreter commented Apr 11, 2015

@ekskimn you may add the WIP tag, so we know that someone may already working on it!

@xzyfer
Copy link
Contributor

xzyfer commented May 13, 2015

This still fails the spec.

@xzyfer xzyfer removed this from the 3.2.3 milestone May 13, 2015
@xzyfer
Copy link
Contributor

xzyfer commented May 13, 2015

Apologies, it looks like my local sass-spec is having issues.

@xzyfer
Copy link
Contributor

xzyfer commented May 13, 2015

This fix was a false positive due to sass/sass-spec#380. The spec still fails.

@xzyfer xzyfer reopened this May 13, 2015
@xzyfer xzyfer removed this from the 3.2.3 milestone May 13, 2015
@tedw
Copy link

tedw commented May 13, 2015

I noticed another issue with & interpolation in @at-root blocks:

.foo {
  @at-root button#{&} {
    color: red;
  }
}

// Generated CSS has an additional selector prepended
.foo button.foo {
  color: red;
}

This wasn't a problem in 3.2.2, only 3.2.3 and later.

I thought it made sense to include this here, but I'm happy to submit a separate issue if you prefer.

Thanks!

@mgreter mgreter removed their assignment May 13, 2015
@mgreter mgreter self-assigned this May 28, 2015
@mgreter mgreter added this to the 3.3 milestone May 28, 2015
@ekskimn
Copy link

ekskimn commented Jun 3, 2015

Hi all, i'm on this bug again...should have a fix for it shortly...I think I know what's going on with it.

@mgreter
Copy link
Contributor

mgreter commented Jun 3, 2015

@ekskimn FYI I actually already have a WIP branch which passes this (an other at-root) issues ...

@ekskimn
Copy link

ekskimn commented Jun 3, 2015

oh? is it pushed to the repo?

@mgreter
Copy link
Contributor

mgreter commented Jun 3, 2015

#1249: Not sure if I already pushed all the latest work. But it's really in a WIP state, so no, it's not yet pushed and needs more refactoring from my side ...

@ekskimn
Copy link

ekskimn commented Jun 3, 2015

Ah i see what you're doing....lol...you really didn't like the contextualize_eval, huh? =)

Do you happen to know when you might push it? My team and I are wanting to get that fix in to fix a particular issue we have.

Also do you happen to know if you're going to merge the selector-functions PR in as well?

@xzyfer
Copy link
Contributor

xzyfer commented Jun 3, 2015

The plan is to @mgreter PR and selector functions with 3.3. As for when that'll be it's hard to say.

@mgreter
Copy link
Contributor

mgreter commented Jul 13, 2015

We now have a passing spec test since #1249 was merged 🎈

@mgreter mgreter closed this as completed Jul 13, 2015
@esr360
Copy link

esr360 commented Sep 4, 2015

@tedw's comment several posts up still seems to be an issue? Is there a separate issue for this?

.foo {
    @at-root button#{&} {
        color: red;
    }
}

outputs:

.foo button.foo {
    color: red;
}

expected:

button.foo {
    color: red;
}

http://sassmeister.com/gist/d610ed626e510cea938c

EDIT: Sorry guys. I can see from this issue that it will be fixed (is fixed) in 3.3 #1491

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

6 participants