-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fix js-breaking webcomponent #3087
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
Fix js-breaking webcomponent #3087
Conversation
@@ -1 +1,10 @@ | |||
import 'clipboard-copy-element'; | |||
document.addEventListener('DOMContentLoaded', () => { | |||
const waitingForOnboarding = setInterval(() => { |
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.
question: why did you wrap it in a set interval? doesn't it already "wait" ? I'm looking at the example you mentioned here https://github.com/webcomponents/webcomponentsjs/#asynchronous
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.
Thanks for pointing that out. I've tried so many things but I forgot to try the most obvious one 😆. I updated it and it seems to be working too.
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 now remember why, Waterfox doesn't seem to acknowledge the waitfor method.
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 gonna merge this for now with an eye towards revisiting. The defer
helps ensure it shouldn’t cause problems. We’ll circle back to this with a permanent fix in future (and with a clearer picture about browser compatibility and what we support)
What type of PR is this? (check all applicable)
Description
It seems that having a standalone copy of
webcomponent-loader.js
is both insufficient and breaking JS on some browser, particularly WaterFox. WebComponent's suggestion to use polyfill is in the follow manner:but that also is not a viable option since we can't load dependency from node-module like that. The next best thing we can do is asynchronously load the polyfill from the CDN based this instruction. The README stated that the loader is efficient and will load only what is necessary.
I have tried to not rely on CDN by letting webpack dynamically import it but that also doesn't seem to work without additional webpack configuration. If there's a more viable solution or I missed something, please let me know.
Related Tickets & Documents
#3081 and quite possibly some users on #2790
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
n/a
Added to documentation?