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

Imported styles take precedence over local styles when declared in same tag #2357

Closed
arthurevans opened this issue Aug 24, 2015 · 3 comments
Closed
Assignees
Labels

Comments

@arthurevans
Copy link

So, if I do:

<style include="shared-styles">
  .foo { color: red; }
</style>

I would expect the local .foo rule to override any imported one. But it appears that the imported rules are added after any rules defined in the body of the tag, so they take precedence:

http://jsbin.com/jivupu/edit?html,output

I'm not sure whether a) this is the expected behavior, and b) whether we even want to document using a style tag with both include and local rules.

Please advise, @sorvell. Thanks.

@sorvell
Copy link
Contributor

sorvell commented Aug 24, 2015

This is expected at the moment. I have to admit that mixing use of a style with include and content inside it is not something that I considered too deeply. I think it could be reasonable to change the behavior to make the includes first.

@sorvell sorvell self-assigned this Aug 24, 2015
@sorvell sorvell added the p1 label Aug 24, 2015
@sorvell
Copy link
Contributor

sorvell commented Aug 24, 2015

Fwiw, sharing styles either with custom-style or in an element have the same 'include applies last' behavior. If we change it in custom-style, we should probably change it for other elements as well.

@ebidel
Copy link
Contributor

ebidel commented Aug 24, 2015

/sub

sorvell pushed a commit that referenced this issue Aug 26, 2015
…e include cannot be found.

Fixes #2357: include data now comes before any textContent in a style element.
MartinMoizard pushed a commit to MartinMoizard/polymer that referenced this issue Sep 8, 2015
… a style include cannot be found.

Fixes Polymer#2357: include data now comes before any textContent in a style element.
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