Another technique is to set an element's display style to none. Thus, it will not need a repaint when its content is being changed. Here is a code example that shows how this can be done:
function myJS()
{
let container = document.getElementById("container1");
container.style.display = "none";
container.style.color = "red";
container.appendChild(moreNodes);
container.style.display = "block";
}
This is an easy and quick way to modify a node while avoiding multiple repaints or reflows.