This question shows research effort; it is useful and clear
5
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
我需要在我编写的附加组件中对整个网页文档进行繁重的 DOM 操作。我想尽量减少回流,这样我所有的操作只会发生一次回流。删除 body 元素,进行操作然后再次插入它不是一种选择,因为这会重新评估所有<script>元素。目前我将 body 的可见性设置为'none'操作之前并在之后恢复 display 的值。不过,我不确定这是否是解决此问题的最佳方法。