mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
Merge pull request #4850 from Polymer/1.x-html-imports-styling-workaround
Copy <style is="custom-style"> to the main document
This commit is contained in:
@@ -123,6 +123,19 @@ Note, all features of `custom-style` are available when defining styles as part
|
||||
if (this.__appliedElement !== this) {
|
||||
this.__appliedElement.__cssBuild = this.__cssBuild;
|
||||
}
|
||||
/*
|
||||
HTML Imports styling the main document are deprecated in Chrome
|
||||
https://crbug.com/523952
|
||||
|
||||
If this element is not in the main document, then it must be in an HTML Import document.
|
||||
In that case, move the custom style to the main document.
|
||||
|
||||
The ordering of `<custom-style>` should stay the same as when loaded by HTML Imports, but there may be odd
|
||||
cases of ordering w.r.t the main document styles.
|
||||
*/
|
||||
if (this.ownerDocument !== window.document && this.__appliedElement === this) {
|
||||
document.head.appendChild(this);
|
||||
}
|
||||
// needed becuase elements in imports do not get 'attached'
|
||||
// TODO(sorvell): we could only do this if and only if
|
||||
// this.ownerDocument != document;
|
||||
|
||||
Reference in New Issue
Block a user