here is simple example. i taught that script below the body-tag doesn't block the rendering phase. such as making domTree, RenderTree, and painting.
So, i thought that firstly, the yellow background will be shown quickly, and then after about 5sec, javascript will change the domTree(CSSOM) and then change to red background
.
but actually, it blocked during 5sec and then, red-background was shown
i wasn't able to see yellow background first.
why the script block the Render phase?
<style>
.section1 {
background-color:yellow;
width:100wh;
height:100vh;
}
</style>
<body>
<div class="container">
<section class="section1"> //
</section>
</div>
<script>
const n = 5000000000 // on my computer it takes about 5sec
for(let i= 0 ; i<n; i++){
}
document.querySelector('.section1').style.backgroundColor = "red"
</script>
</body>