After read how browser works and browser rendering process, I still have confusion about browser parse process when encounter <script>
tag, which the posts not really cover.
The main process is described in the following pic:
Suppose we have a simple html
<html>
<head>
<link rel="stylesheet" href="main.css">
<script src="main.js"></script>
<link rel="stylesheet" href="another.css">
</head>
<body>
</body>
</html>
Questions:
- Browser is single thread, so how does HTML Parser and CSS Parser work parallel
- In HTML Parser, when encounter
<script>
tag, does browser halt until js file is downloaded and executed complete? For this example, browser will not downloadanother.css
untilmain.js
download and execute?