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
With the continuous development of the Internet ec...
Table of contents 1. Download MySQL 2. Unzip the ...
This article example shares the specific code of ...
Read uncommitted example operation process - Read...
Tetris is a very classic little game, and I also ...
Table of contents 1. Introduction 2. Install Dock...
In order to avoid repeatedly entering the Docker ...
Due to the needs of the work project, song playba...
Table of contents Introduction and Demo API: Cont...
To replace a string, we need to use the following...
In the process of web project development, we oft...
Table of contents initialization initState() init...
The web color picker function in this example use...
1. Download the software 1. Go to the MySQL offic...
Table of contents A JSON is built on two structur...