ecometer

Keep DOM access via JavaScript to a minimum

(Development)
#32

Accessing the DOM (Document Object Model) via JavaScript is a heavy process that uses a lot of processor power (CPU). Minimize this type of access as much as possible.
To do so, you can assign a node to variables that you will repeatedly use in the application’s lifecycle, which avoids traversing the tree each time the document is manipulated.
Libraries such as ‘Shadow DOM’ can also be used to optimize the tree though a batch system.

To learn more, read about W3C’s Shadow DOM project at:
https://w3c.github.io/webcomponents/spec/shadow/

W3C’s recommendations to minimize DOM access via JavaScript: