Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when the script abrupts another script

WHATWG spec has interesting step in prepare the script element algorithm:

Otherwise, immediately execute the script element el, even if other scripts are already executing.

What is that case? How does one script may pause of executing another script?

like image 304
MaximPro Avatar asked Dec 28 '25 14:12

MaximPro


1 Answers

Given the constraints, it's a script that is not a module, does not have a src attribute, and is inserted during a script execution. I think the following example qualifies:

<script>
console.log("before");
document.write(`<script>
console.log("nested");
<\/script>`);
console.log("after");
</script>
like image 140
Bergi Avatar answered Dec 31 '25 18:12

Bergi