clone global stylesheet elements into root for shadowdom support#223
clone global stylesheet elements into root for shadowdom support#223
Conversation
|
Nice! |
|
Put it all under one for loop and moved it all to a function and made sure it only does it once since it is in a _typeChanged function |
|
|
||
| var stylesheetsArray = Array.from(stylesheets); | ||
|
|
||
| for (var i = 0; i < stylesheetsArray.length; i++) { |
There was a problem hiding this comment.
.forEach should be safe for both Array and NodeList
Nice, looks great. |
| * Queries global document head for google charts link#load-css-* and clones | ||
| * them into the local root's div#styles element for shadow dom support. | ||
| */ | ||
| _localizeGlobalStylesheets: function() { |
There was a problem hiding this comment.
I think my version in #204 handles some edge cases a little better.
https://github.com/GoogleWebComponents/google-chart/pull/204/files#diff-d0b4f475ae2630d8efc01169d1a41af6R80
There was a problem hiding this comment.
I merged this on behalf of an internal request from a blocked user. I'd 100% be willing to review your import CL over this implementation.
google-chart never worked in shadow dom. I have cloned the global
link[rel="stylesheet"]#load-css-*into each instance root. This should make the styles available to each shadow root. Demos now work.#load-css-* because the format of google chart styles are #load-css-0, #load-css-1, etc.