This blog post suggests that textContent is preferable to innerText for avoiding layout thrashing. But it is focused on retrieving an element\'s text;
You are correct! Just like you observed. Setting textContent does cause thrashing.
Here is what the DOM specification has to say:
textContent of type DOMString, introduced in DOM Level 3
This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.
A non thrashing way would be to get the element's text nodes and modify those instead of using textContent or innerText (which is non standard).
var test = document.getElementById("test");
var a = document.createTextNode("");
test.appendChild(a);
setInterval(function(){
a.nodeValue = "Test test test";
},100);
Of course if the actual text will change, a paint will have to occur to update what you're seeing.
