Let's say I have an HTML file that I want to process using Javascript. For instance:
- Add some DOM elements, such as wrappers
spanor div. - Change the style of the document, for example, the size of the base font, line height, etc.
- Use a defender to add objects
­.
What would be the most efficient way to do this, i.e. I would like to do this with a minimal number of transitions.
An ideal case would be to run the JS code even before the first layout. Is it possible? I know, as a rule, it’s a bad idea to execute expensive scripts before the page has been displayed for this, will make the page look blank for some time, and this is a really bad experience. However, I will need this to work offline, and this will not be a problem for my project.
Or, is there a way to make all the dom modifications in one group, i.e. after all changes are over, will re-planning take place?
source
share