我有点不清楚 reflow + repaint 之间的区别(如果有任何区别的话)
似乎回流可能会改变各种 DOM 元素的位置,而重绘只是渲染一个新对象。例如。删除元素时会发生回流,更改颜色时会发生重绘。
这是真的吗?
最佳答案
这篇文章似乎涵盖了回流与重绘的性能问题
至于定义,来自那个帖子:
A repaint occurs when changes are made to an elements skin that changes visibly, but do not affect its layout.
Examples of this include
outline
,visibility
,background
, orcolor
. According to Opera, repaint is expensive because the browser must verify the visibility of all other nodes in the DOM tree.A reflow is even more critical to performance because it involves changes that affect the layout of a portion of the page (or the whole page).
Examples that cause reflows include: adding or removing content, explicitly or implicitly changing
width
,height
,font-family
,font-size
and more.
在 http://csstriggers.com 了解哪些 css 属性会影响重绘和查看
关于javascript - 回流和重绘有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2549296/