mirror of
https://github.com/ankitects/anki.git
synced 2026-01-09 03:53:55 -05:00
Fix: Strict mode prevents functions from being declared in eval
This commit is contained in:
parent
73f161088f
commit
f38a3439f7
1 changed files with 6 additions and 1 deletions
|
|
@ -65,7 +65,12 @@ addEventListener("message", async (e: MessageEvent<InnerReviewerRequest>) => {
|
||||||
|
|
||||||
// "".innerHTML =" does not run scripts
|
// "".innerHTML =" does not run scripts
|
||||||
for (const script of document.querySelectorAll("script")) {
|
for (const script of document.querySelectorAll("script")) {
|
||||||
eval(script.innerHTML);
|
const parent = script.parentElement!;
|
||||||
|
const _script = script.parentElement!.removeChild(script);
|
||||||
|
const new_script = document.createElement("script");
|
||||||
|
const new_script_text = document.createTextNode(_script.innerHTML);
|
||||||
|
new_script.appendChild(new_script_text);
|
||||||
|
parent.appendChild(new_script);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue