采用以下示例 index.html :


 <!DOCTYPE html>
< html> 
< head lang =“en”>
 < meta charset =“UTF-8”>
 < title>< / title>
< / head>
< body>
< h1 id =“heading”> h1< / h1>
< script type =“text / javascript”async src =“1.js”>< / script>
< script type =“text / javascript”async SRC = “2.js” >< /脚本>
< / BODY>
< / HTML>
 代码>

&# xA; 1.js :


 document.getElementById(“heading”)。style.color =“blue” ;
 代码>


 2.js :


 document.getElementById(“heading”)。style.color =“red”;



 Internet Explorer(11.0) .9600.17801)和 Firefox(38.0.1)总是导致标题为红色。


然而谷歌浏览器(45.0.2412.0金丝雀64位)偶尔会产生蓝色。始终首先请求 1.js 。只有在 2.js 之后 1.js 的网络请求完成时,才会发生此异常。发生这种情况时,我们可以从有序的脚本事件中看出,因为首先处理 2.js :


导致 2.js 的脚本事件偶尔发生在 Google Chrome 中的 1.js 之前的原因是什么?它是否与前面的事件有关,例如加载(解析),渲染或绘制?


这些是唯一正在执行的3个源文件,没有黑盒子脚本和 index.html ,而不是在本地或远程服务器上读取。