|
|
|
@ -19,11 +19,10 @@ export function create_fragment_with_script_from_html(html) {
|
|
|
|
var scripts = content.querySelectorAll('script');
|
|
|
|
var scripts = content.querySelectorAll('script');
|
|
|
|
for (const script of scripts) {
|
|
|
|
for (const script of scripts) {
|
|
|
|
var newScript = document.createElement('script');
|
|
|
|
var newScript = document.createElement('script');
|
|
|
|
if (script.src) {
|
|
|
|
for (var i = 0; i < script.attributes.length; i++) {
|
|
|
|
newScript.src = script.src;
|
|
|
|
newScript.setAttribute(script.attributes[i].name, script.attributes[i].value);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
newScript.textContent = script.textContent;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
newScript.textContent = script.textContent;
|
|
|
|
/** @type {Node} */ (script.parentNode).replaceChild(newScript, script);
|
|
|
|
/** @type {Node} */ (script.parentNode).replaceChild(newScript, script);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
|