No, you can very well modify the DOM without causing any repaint.
Take for instance an element whose display is set to none
. It's still in the DOM, but discarded by the CSSOM and won't cause any repaint if modified:
setTimeout(() => {
content_div.textContent = 'I got modified';
console.log(content_div.outerHTML) // "<div id="content">I got modified</div>"
}, 1000);
#hidden {
display: none;
}
<div id="wrapper">
some hidden content below
<div id="hidden">
<div id="content_div">I will get modified</div>
</div>
<div>
Now, I feel you need to understand the basics of the subject, so see this Q/A which explains the three phases of the browser's redraw operation:
- DOM Update (sync)
- Reflow (normally async but can be forced synchronously)
- Repaint (async @60 FPS max)
And for the specs, it's here.