Comments (1)
- 首先渲染引擎下载HTML,解析生成DOM Tree
- 遇到css标签或JS脚本标签就新起线程去下载他们,并继续构建DOM。(其中css是异步下载同步执行)浏览器引擎通过 DOM Tree 和 CSS Rule Tree 构建 Rendering Tree
- 通过 CSS Rule Tree 匹配 DOM Tree 进行定位坐标和大小,这个过程称为 Flow 或 Layout 。
- 最终通过调用Native GUI 的 API 绘制网页画面的过程称为 Paint 。
当用户在浏览网页时进行交互或通过 js 脚本改变页面结构时,以上的部分操作有可能重复运行,此过程称为 Repaint 或 Reflow。 重排是指dom树发生结构变化后,需要重新构建dom结构。 重绘是指dom节点样式改变,重新绘制。 重排一定会带来重绘,重绘不一定有重排。
如何减少浏览器重排:将需要多次重排的元素,position属性设为absolute或fixed,这样此元素就脱离了文档流,它的变化不会影响到其他元素。
from my-blog.
Related Issues (20)
- 专题8: 设计模式之装饰器模式
- 专题9: 发布订阅者模式
- 专题10: js 是如何引用 css 的?
- 专题11: 将js/css打包进html,并配置 devServer
- 专题12: 配置loader如:ts、babel、less|sass
- 专题13: webpack性能优化上(Code Splitting、Tree Shaking)
- 专题14: 手写一个loader,实现一个可选链(obj?.foo?.bar)
- 专题15: webpack性能优化2 (happypack、dllplugin、cache-loader)
- 专题16: webpack之多页面配置
- 专题17: 手写一个webpack插件
- 专题18: webpack 搭建 ssr
- 专题19: vue-next 项目搭建
- 专题20: vue3 响应式原理
- 合并两个有序数组为一个有序数组
- 浏览器跟node的 event loop 区别
- Webpack原理—编写Loader和Plugin
- TCP四次挥手
- 什么是CDN,对SEO优化有什么帮助
- js异步加载(defer、async、module)和预加载(preload、prefetch、subresource、prerender)前端文件
- 2019面经文
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from my-blog.