Defer JavaScript scripts in html_document#2046
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
srcis converted wrongly.See highlighted line and the last line in the following image.
Reprex
(closes #2032)