why clonenode script does not execute in firefox. it works fine in chrome?
<script id="myscript" src='myscript.js' type='text/template'></script>
I am cloning it by replacing the type='text/template' to 'text/javascript'
const existing = document.querySelector("#myscript");
const newScript = existing.cloneNode();
newScript.type = 'text/javascript';
existing.replaceWith(newScript);
what can be the reason?
It would appear that Firefox is cloning the flag saying that that script has been processed, but Chrome isn't. (I've been able to replicate your result.)
To do this reliably, create a new element instead: