浏览器对Html的解析过程

Posted Sahadev_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了浏览器对Html的解析过程相关的知识,希望对你有一定的参考价值。

Parsing means analyzing and converting a program into an internal format that a runtime environment can actually run, for example the javascript engine inside browsers.

The browser parses html into a DOM tree. HTML parsing involves tokenization and tree construction. HTML tokens include start and end tags, as well as attribute names and values. If the document is well-formed, parsing it is straightforward and faster. The parser parses tokenized input into the document, building up the document tree.

When the HTML parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. Parsing can continue when a CSS file is encountered, but

When the browser encounters CSS styles, it parses the text into the CSS Object Model (or CSSOM), a data structure it then uses for styling layouts and painting. The browser then creates a render tree from both these structures to be able to paint the content to the screen. JavaScript is also downloaded, parsed, and then execute.

JavaScript parsing is done during compile time or whenever the parser is invoked, such as during a call to a method.

以上是关于浏览器对Html的解析过程的主要内容,如果未能解决你的问题,请参考以下文章

浏览器对Html的解析过程

我用一张图彻底理解了浏览器的解析机制

http请求的全过程

一次完整的网络请求过程

一个完整的HTTP请求过程详细

HTTP请求过程