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

Feature request: Using the :host() function pseudo-class with parent selectors #2825

Closed
Sleeckx opened this issue Feb 13, 2019 · 1 comment
Closed

Comments

@Sleeckx
Copy link

Sleeckx commented Feb 13, 2019

While writing some Shadow DOM based custom elements I run into the case where I need to use the :host() function pseudo-class in order to style a child element.

In spec v0 I used to write the following code:

:host {
  &.foo {
    ...
  }
}

This would compile to :host.foo {... and works fine.

Now with v1 of the spec I have to use the function pseudo-class to do the same:

:host() {
  &.foo {
    ...
  }
}

However, as expected, this compiles to the incorrect css :host().foo.

I tried going around this by creating a mixin that would interpolate the arguments and generate correct css. However this will never be possible for the following sass code:

:host {
  &.foo {
    &[disabled] {
      ...
    }
  }
}

The result of the above code should be :host(.foo[disabled]) {...

Are there any plans to support this scenario? Or is there a way around?

Maybe add an exception for parent selectors in combination with :host to automatically generate a function pseudo-class?

@mgreter
Copy link
Contributor

mgreter commented Jun 17, 2019

This has slightly changed since #2908 and the first example now results in .foo as does dart sass.
It's not 100% clear what the expected behavior OP is looking for (examples with explicit example input and expected output would help). But I'm also quite sure that we do handle it the same as dart sass. So closing this as "not in sass". Feature request for the sass language in general should be posted at https://github.com/sass/sass. Thanks!

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

2 participants