fix(Customize/CSS-HTML): When copy the script text, also copy the script attributes

This commit is contained in:
haitao(lj) 2022-12-20 17:33:47 +08:00
parent 65059229bb
commit 8f38a18512
1 changed files with 5 additions and 1 deletions

View File

@ -34,7 +34,11 @@ const ActivateScriptNodes = (el, part) => {
}
scriptList.forEach((so) => {
const script = document.createElement('script');
script.textContent = so.textContent;
script.text = so.text;
for (let i = 0; i < so.attributes.length; i += 1) {
const attr = so.attributes[i];
script.setAttribute(attr.name, attr.value);
}
el.replaceChild(script, so);
});
};