-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Defer JavaScript scripts in html_document #2046
base: main
Are you sure you want to change the base?
Conversation
<script src="header-attrs-2.6.6/%5Bobject%20Object%5D"></script> is this when decoded: <script src="header-attrs-2.6.6/[object Object]"></script> It seems when the > "header-attrs-.../" + { "src": "foo.js", "defer": null}
"header-attrs-.../[object Object]" I don't know where this string concatenation occurs. We will need help from the Shiny team (perhaps @cpsievert). |
I'm pretty sure the script rendering issue is essentially a duplicate of rstudio/shiny#3345 I'll try to have a fix up by the end of the week |
Ok, rstudio/shiny#3345 should be fixed on the main branch now, so the By the way, it's not immediately obvious to me that |
@cpsievert Thanks a lot!
Would you tell me some background of this suggestion? |
Maybe the best way is to
I wonder if there is an easy way to handle this for developers of custom formats or HTML dependencies. |
This PR defers JavaScript scripts that are currently called as DOMContentLoaded event handlers.
Although this works fine in static
html_document
, it still fails inruntime: shiny
.This is probably because
src
is converted wrongly.See highlighted line and the last line in the following image.
Reprex
(closes #2032)