I have found that script :
<div id="hezi-gangina"></div>
<script>
if(document.all)
{
document.getElementById('hezi-gangina').innerText="This line was created via innerText";
}
else
{
document.getElementById('hezi-gangina').textContent="This line was created via textContent";
}
</script>
Which makes me realize that innerText is not safe to use (...or am I wrong here)?
Which brings out 2 questions :
Why should I use
innerText
anyways if it's not going to work properly on all browsers (unless the benefit ofinnerText
is...) ?Is
textContent
is safe to use and would work in every scenario ?