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

Custom properties defined on :host shouldn't override document styles. #1555

Closed
philipwalton opened this issue May 17, 2015 · 0 comments · Fixed by #1602
Closed

Custom properties defined on :host shouldn't override document styles. #1555

philipwalton opened this issue May 17, 2015 · 0 comments · Fixed by #1602

Comments

@philipwalton
Copy link

According to the spec, rules from outside a shadow tree always win against rules within a shadow tree, when they attempt to style the same element:
http://dev.w3.org/csswg/css-scoping/#cascading

It seems that Shady DOM correctly handles this with regular properties, but not with custom properties. Consider the following example:

<dom-module id="my-element">
  <style>
    :host {
      --color: red;
      color: var(--color);
      background: yellow;
    }
  </style>
  <template>
    content...
  </template>
</dom-module>

With the following external styles defined:

<style is="custom-style">
  my-element {
    --color: blue;
    background: pink;
  }
</style>

The result should be blue text with a pink background since document style should win here; instead, I see red text with a pink background.

That means Polymer is correctly determining that the outside background:pink property should win, but incorrectly not doing the same with the outside --color:blue custom property.

sorvell pushed a commit that referenced this issue May 23, 2015
…rties so scope properties override them; also adds '*' as an own scope matcher. Own scope properties are applied last; this gives the element the final say and allows property retargeting.
@sorvell sorvell mentioned this issue May 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants