There are some
between the two contestants.
Most noticeable IMO that
innerText triggers a re-flow, thus, whenever possible use
And I found a surprising one on top:
someNode.innerText = `some multi line text !`;
Expecting the content of
someNode to have three lines, maybe with line breaks in the code,
but to render as simple text in one line - ignoring line breaks as usual.
Turns out, line breaks get converted to
Very unexpected… and IMO very wrong!
textContent to the rescue!
It behaves as expected: Line breaks? Yes.
<br> tags? No!
Another reason for
The final results for
textContent is 0:2 -
textContent is the clear winner of this match.