-
Notifications
You must be signed in to change notification settings - Fork 130
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.forEach should be safe for both Array and NodeList
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.
Oh not for IE11 though maybe?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.