It says that
textContent is lighter, with better performance.
innerText is heavy, requires some layout system information. And cannot insert HTML into this.
innerHTML has cross site security attacks, so it's always better to avoiding using this. But it can insert HTML into this.
but basically, if any of those could be run successfully, then the other two should also be working.
Here is an article to explain that textConent is better than innerHTML and innerText (Why textContent is better than innerHTML and innerText?)
It says that
textContent
is lighter, with better performance.innerText
is heavy, requires some layout system information. And cannot insert HTML into this.innerHTML
hascross site security attacks
, so it's always better to avoiding using this. But it can insert HTML into this.but basically, if any of those could be run successfully, then the other two should also be working.
result in the
test console
should beopen it
let's open the 0
Therefore, in the testing, there should be no big differences to use them.