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] Style scoped immediate descendant selector no longer matches projected content #1312

Closed
cdata opened this issue Mar 19, 2015 · 1 comment
Labels

Comments

@cdata
Copy link
Contributor

cdata commented Mar 19, 2015

Consider the following Polymer custom element template:

<dom-module id="x-foo">
<style>
  paper-button > span {
    color: red;
  }
</style>
<template>
  <paper-button>
    <span>Label</span>
  </paper-button>
</template>
</dom-module>

In ShadeyDOM, the style selector will be rewritten to:

paper-button[style-scope=x-foo] > span[style-scope=x-foo] {
  color: red;
}

But since paper-button projects its content into a child of its own shadow / shade, the DOM will be arranged analogously to this:

<paper-button style-scope="x-foo">
  <some-container style-scope="paper-button">
    <span style-scope="x-foo">Label</span>
  </some-container>
</paper-button>

And the rule will no longer match.

@cdata cdata added the 0.8 label Mar 19, 2015
@sorvell
Copy link
Contributor

sorvell commented May 22, 2015

Structural selectors like this are problematic in the context of non-native projection. Instead, it's better to select the element directly (e.g. span). Because an element's css is scoped to element's local dom structural selectors should be needed much less than previously. It is possible to use a descendant selector but it's better for performance to select the element explicitly.

@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

2 participants