-
Notifications
You must be signed in to change notification settings - Fork 950
Use data-jupyter-widgets-cdn-only attribute to load modules only from CDN #2792
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
Conversation
@jasongrout Friendly ping |
@jasongrout Would you have time to take a look? |
|
||
// find the data-cdn for any script tag, assuming it is only used for embed-amd.js | ||
const scripts = document.getElementsByTagName('script'); | ||
Array.prototype.forEach.call(scripts, (script: HTMLScriptElement) => { | ||
cdn = script.getAttribute('data-jupyter-widgets-cdn') || cdn; | ||
onlyCDN = | ||
onlyCDN || script.getAttribute('data-jupyter-widgets-cdn-only') != null; |
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.
Can you use hasAttribute
instead? https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
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.
TIL, Thanks!
Thanks! This looks okay to me. Congratulations on your first contribution to ipywidgets! |
Thanks @jasongrout for the review! |
Resolves #2786
This PR's changes are learned from previous similar PR: 8aba183
Hi @jasongrout!
Can you help me review this?
I'm not sure how to test, because if I run
yarn test
, this fails at build step already in master branch.