当前位置:网站首页>DOM - page rendering process
DOM - page rendering process
2022-08-02 16:35:00 【z_Xiao Zhang classmate】
After the user enters the url (web address) in the browser address bar, the stage that the page goes through when the page is rendered:
- The browser receives the URL and starts the network request thread.
- A complete HTTP request is issued
- The server receives the request and goes to specific background processing
- HTTP interaction between front and backend and designed caching mechanism
- The critical rendering path after the browser receives the packet
- The parsing process of the JS engine
(For the specific process, please check and learn online by yourself)
The general process of loading an html document by a browser is divided into the following stages:
1) Parse tags, text, comments, attributes, etc. into a node tree (DOM Tree)
2) When parsing nodes in the node tree (DOM Tree), different operations will be performed if different elements are encountered:
a. If css code is encountered, the css code will be parsed into a CSS style structure
B. When encountering src, it will load (network request) resources
3) Combine the CSS style structure with the node tree DOM Tree into a render tree/Render Tree
4) Draw the page according to the Render Tree
Redraw and Reflow
Redraw: It is to redraw and render the page according to the structure of the document tree
Reflow: The number of elements on the page and the position of the nodes in the tree have changed
Relationship between redrawing and reflow: reflow must cause redrawing, but redrawing does not necessarily cause reflow
hello
Frequent redrawing and reflow will cause poor page performance. Therefore, when operating the page, try to avoid high-frequency redrawing and reflow.
For example: Create 10,000 cells in a table. If ordinary creation and addition, it will be redrawn and reflowed frequently, so we can create an element to carry the element to be rendered:
Using this method, you can avoid high-frequency redraw and reflow operations, and it will not affect the performance of the page.
边栏推荐
猜你喜欢
hybrid 实现同网段但不同vlan之间通讯
nodejs 的下载安装与环境配置
WeTest----如何查看Wetest生成测试报告?
网络运维系列:GoDaddy Shell DDNS配置
Xshell 使用删除键乱码问题
Three-way joint interface data security issues
appium 报错:AttributeError:
DOM —— 事件代理
解决启动filebeat时遇到Exiting: error unpacking config data: more than one namespace configured accessing错误
web渗透之sql注入
随机推荐
【网络参考模型】
FIR滤波器设计之窗函数法
grub 命令使用
Jenkins 参数化构建(Extended Choice Parameter)
Xshell 使用删除键乱码问题
小知识系列:Fork之后如何与原仓库分支同步
screen 不间断会话服务
【软件测试】基础篇
一个简单的 erlang 的 udp 服务器和客户端
abstract和接口的基础知识
【软件测试】用例篇
关于导出聊天记录这件事……
velocity模板页面四则运算
hybrid 实现同网段但不同vlan之间通讯
Mysql锁机制与事务隔离
【软件测试】概念篇
Mysql索引优化二
Template Series - Dichotomous
JVM常量池详解
Three-way joint interface data security issues