FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Inject styles into Shadow DOM when inside Shadow DOM (#5763) by Simon-Tang · Pull Request #6556 · chartjs/Chart.js · GitHub

Inject styles into Shadow DOM when inside Shadow DOM (#5763) - #6556

Merged
etimberg merged 1 commit into
chartjs:masterfrom
Simon-Tang:feature-responsive-web-components
Oct 25, 2019
Merged

Inject styles into Shadow DOM when inside Shadow DOM (#5763)#6556
etimberg merged 1 commit into
chartjs:masterfrom
Simon-Tang:feature-responsive-web-components

Conversation

Simon-Tang commented Oct 6, 2019
edited by kurkle
Loading

Copy link
Copy Markdown
Contributor
  • Injects the inline <style> used by ChartJS into document.head and each Shadow Root as needed
  • Adds a node[EXPANDO]: { containsStyles: boolean } to document.head and each Shadow Root that contains a ChartJS instance
  • Removes the flags platform._style and platform._loaded since we now need to keep track of multiple <style> insertions

To-do(?):

  • Karma tests to test responsive behaviour inside Web Components
  • Update documentation to include the need for manually including the <script> inside Shadow DOMs in the case of disableCSSInjection: true - example workaround

Closes: #5763

kurkle commented Oct 7, 2019

Copy link
Copy Markdown
Member

Looks good!

Can you add a test pen where the functionality can be verified? (Fork https://stackblitz.com/edit/polymer310-testcase-chartjs for example)

Copy link
Copy Markdown
Contributor Author

Thanks @kurkle. I'm not sure what's up with the error I'm getting when using customElements but here is what I've been using for testing:

https://stackblitz.com/edit/polymer310-testcase-chartjs-zxndkp

I copied my exact testing page into index2.html in the above. I'm getting this error:

Error: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

If any reviewer has the patience to help out with this I would appreciate it a lot! I'm not really sure if I'm missing something obvious to make this work. However I would expect the pen you linked (https://stackblitz.com/edit/polymer310-testcase-chartjs) to also work with the changes in this PR.

kurkle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

etimberg merged commit 0b62f28 into chartjs:master Oct 25, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart does not resize inside shadow DOM (e.g. Polymer)

3 participants


Back | FazBrowse Home | New Git URL