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

Shady DOM custom properties don't inherit. #1388

Closed
philipwalton opened this issue Apr 9, 2015 · 1 comment
Closed

Shady DOM custom properties don't inherit. #1388

philipwalton opened this issue Apr 9, 2015 · 1 comment
Assignees
Labels

Comments

@philipwalton
Copy link

Consider the following element:

<dom-module id="my-element">
  <style>
    :host {
      --color: red;
    }
    div {
      --color: green;
    }
    p {
      color: var(--color);
    }
  </style>
  <template>
    <div>
      <p>Some paragraph text...</p>
    </div>
  </template>
</dom-module>

<script>
  Polymer({
    is: "my-element",

    // The custom properties shim is currently an opt-in feature
    enableCustomStyleProperties: true
  });
</script>

<my-element></my-element>

The text should be green but it's red instead.

@sorvell
Copy link
Contributor

sorvell commented May 22, 2015

With native platform support for custom properties, this would work as described. Polymer's custom properties shim does not support this type of parent to child inheritance. Instead inheritance is only allowed between element local dom scopes.

The rule is that a property can have only 1 value applied to a given local dom scope. In this case, it's the value defined in :host.

Polymer's custom property shim is primarily designed to solve cross scope (element local dom) styling, and intra-scope inheritance is not required for that use case.

@sorvell sorvell closed this as completed May 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants