Front-end performance optimizations: Which DOM action queries cause a refresh of the render tree?

Source: Internet
Author: User
Because the amount of computation is related to each re-typesetting, most browsers optimize the re-typesetting process through queued modification and batch display. However, you can
Can (often involuntarily) force queues to refresh and require that all planned changes be applied immediately. Getting layout information will cause the brush

New queue actions, which means that the following methods are used:


? OffsetTop, Offsetleft, offsetwidth, offsetheight
? ScrollTop, ScrollLeft, ScrollWidth, scrollheight
? ClientTop, ClientLeft, ClientWidth, clientheight
? getComputedStyle () (Currentstyle in IE) (this function is called currentstyle in IE)


The layout information is returned by these properties and methods to the latest data, so the browser has to run the items in the render queue to be changed and rearrange
Version to return the correct value.


In the process of changing styles, it is best not to use the attributes listed earlier. Any access will flush the render queue, even if you are
Get layout information that hasn't changed recently or has nothing to do with the latest changes.

Front-end performance optimizations: Which DOM action queries cause a refresh of the render tree?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.