Open
Description
const script = document.createElement('script');
script.textContent = source;
script.type = 'module';
document.head.append(script);
How would I know when the above script has executed?
- We know the answer with classic/module scripts with a
src
, as there's a"load"
event. - We know the answer with classic scripts without a
src
, as it's synchronous.
However, module scripts without a src still execute asynchronously, but there's no "load"
event.
It feels like we should dispatch a "load"
event for all module scripts, not just those from an external file. WDYT @domenic?
This was raised in https://bugs.chromium.org/p/chromium/issues/detail?id=1180532#c8.