-
Notifications
You must be signed in to change notification settings - Fork 131
Make sure inlined style imports are ordered correctly #577
Conversation
Previously, `<link rel="import" type="css">` styles were inlined by prepending to the top of the `<dom-module>` template. However, if there were multiple imports, the order would be reversed, which can cause incorrect styling when overriding. This commit makes sure the order remains correct for multiple style imports. Fixes #575
this.prepend(domTemplate.childNodes[0], style); | ||
} else { | ||
// put this style behind the last polymer external style | ||
dom5.insertBefore(domTemplate.childNodes[0], nextSibling(lastPolymerExternalStyle), style); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it would be easier to have the promises resolve with the style, and then in the then
take the array of styles from Promise.all
and append them in one go?
Or else just reverse the array of links to make inserting easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really not inclined to go refactor this deprecated branch too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, LGTM then
I thought the |
@stramel deprecated, but not removed for Polymer 1.x, nor for 2.x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Mergin'
Previously,
<link rel="import" type="css">
styles were inlined byprepending to the top of the
<dom-module>
template.However, if there were multiple imports, the order would be reversed,
which can cause incorrect styling when overriding.
This commit makes sure the order remains correct for multiple style
imports.
Fixes #575