Search code examples
javascriptdombrowsercssom

After downloading the CSS, does CSS parsing and DOM parsing go side by side


What i know when browser sees a script tag in while parsing html it stops its execution and get the script executes it and then again starts parsing the dom.

Does the same thing happen for CSS as well? or can CSSOM parsing and dom parsing goes side by side.

UPDATE

I think my question wasn't clear, i was not asking about the order of css loading i know CSS files are added in the order they are included. My question was once they gets downloaded, the browser does a CSS parsing and while doing so does the browser stops the dom parsing, as we have the case with script loading. I hope my question is clear now.


Solution

  • Java Scrips are executed as soon as they are interpreted so the answer here is yes. With styles the things are not the same - they are applied just after the html document is completed.

    You can read a very good article about this here:

    http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/