Rendering pipeline with external css files In the above figure, there is an idle time between requesting HTML data and building DOM, which may become a bottleneck for page rendering. After the DOM is built, the rendering pipeline is waiting until the CSS file is downloaded, because the next step is to synthesize the layout tree. The composite layout tree requires CSSOM and DOM, so you need to wait for the CSS to be loaded and parsed into CSSOM. In this case, the CSS does not block the generation of the DOM. The role of CSSOM
Rendering pipeline for pages with inline JS and external CSS As can be seen from the above figure, when encountering JS during DOM construction, construction will be stopped and JS will be parsed and executed, because JS may modify the current DOM. Before executing the JS script, if the page contains external CSS or inline CSS, the rendering engine needs to convert them to CSSOM in advance. Because JS has the ability to modify CSSOM, it also depends on CSSOM before JS is executed. This means that CSS will also block DOM generation in some cases. Rendering pipeline for pages with external JS and CSS During the pre-parsing process of the requested HTML data, it is detected that there are external JS and CSS files that need to be downloaded, and download requests for the two files are initiated at the same time. The download times are not overlapping, but are calculated based on the longest one. Regardless of which one arrives first, CSS or JS, you must first wait until the CSS file is downloaded and CSSOM is generated, then execute the JS script, and finally build the DOM, layout tree, and draw the page. Factors affecting page display and optimization strategies There are three stages from entering the URL to the first display of the page:
The second stage has the greatest impact on user experience, including parsing HTML, downloading CSS, downloading JavaScript, generating layout trees, drawing pages, and other operations. Optimization strategy
The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Top 10 Time-Saving Tips to Shorten Web App Development (Graphical Tutorial)
>>: How to create your first React page
Table of contents React upload file display progr...
When developing and debugging a web application, ...
Table of contents Directory Structure bin directo...
prune To use this command, both the client and da...
As the number of visits increases, the pressure o...
Table of contents The first method: router-link (...
When the Docker container exits, the file system ...
Its function is to set a global style. Then your s...
Table of contents MutationObserver API Features I...
Preface I recently sorted out my previous notes o...
There is a table in the project that needs to be ...
Table of contents Preface Error Object throw try…...
Strictly speaking, nginx does not have a health c...
1. Introduction The telnet command is used to log...
This article briefly introduces the process of se...