Skip to content

Loading…

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

Closed
arthurevans opened this Issue · 3 comments

3 participants

@arthurevans
Owner

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
Owner

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
@sorvell sorvell added the p1 label
@sorvell
Owner

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
Owner

/sub

@sorvell sorvell referenced this issue from a commit
@sorvell sorvell Fixes #2356: issue a warning and don't throw an exception when a styl…
…e include cannot be found.

Fixes #2357: include data now comes before any textContent in a style element.
a16ada1
@frankiefu frankiefu closed this in #2375
@MartinMoizard MartinMoizard referenced this issue from a commit in MartinMoizard/polymer
@sorvell sorvell Fixes #2356: issue a warning and don't throw an exception when a styl…
…e include cannot be found.

Fixes #2357: include data now comes before any textContent in a style element.
6365cf6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.