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

[0.8] host-context improperly shimmed #1346

Closed
robdodson opened this issue Mar 29, 2015 · 3 comments
Closed

[0.8] host-context improperly shimmed #1346

robdodson opened this issue Mar 29, 2015 · 3 comments

Comments

@robdodson
Copy link
Contributor

If I have an element named x-foo, using :host-context in an external stylesheet gets converted to x-foo-context

@sorvell
Copy link
Contributor

sorvell commented May 22, 2015

:host-context is not supported in 0.8+. Instead you should use Polymer's custom properties shim for this type of cross-scope styling.

@sorvell sorvell closed this as completed May 22, 2015
@robdodson
Copy link
Contributor Author

@sorvell So what would that look like? I was trying to do something like this:

:host-context(.fancy)

@sorvell
Copy link
Contributor

sorvell commented May 23, 2015

Something like this:

In the scope where you have .fancy:

<style>
  x-foo.fancy {
    --fancy: {
      color: red;
    }
  }
</style>

In the element (e.g x-foo)

:host {
  @apply(--fancy);
}

It's not exactly the same, but instead of the element having to anticipate exactly how it might be styled, it delegates this power, where appropriate, to the user.

Fwiw, we're not totally ruling out adding support for :host-context and will consider user feedback, but we'd like to encourage using properties for these use cases.

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

3 participants