4 ms·
> innerText is pretty much always frown upon Ugh, and here I was thinking this one was the 'better' one to use than innerHTML (if you can get away with it, whe
by Aardwolf 4y ago
> innerText is pretty much always frown upon
Ugh, and here I was thinking this one was the 'better' one to use than innerHTML (if you can get away with it, when needing just unformatted text and not needing the convenience of HTML tags being automatically formatted for you)
- theobeers 4y agoThis blog post is from 2015—which should be added to the title here on HN. See MDN's docs on innerText. It's fully supported in Firefox since version 45 (2016). (Edit: the blog post also has an update at the bottom, noting that, as of 2016, the situation was already much better.) https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement...
- lucideer 4y agoI don't think the article is saying it should be frowned upon, just that it traditionally has been (not always for valid reasons). It's always been considered better than innerHTML though; it's only textContent people think it's worse than.