Why is the new line rendered correctly for real DOM Elements while getting them through innerText, but not considered when I create them using some javascript?
What is wrong with this code snipet?
const real = document.querySelector('p');
const fake = document.createElement('p');
fake.innerHTML = 'foo<br>bar';
console.log(real.innerText); // this is not similar
console.log(real.textContent);
console.log(real.innerHTML);
console.log(fake.innerText); // to this, but why?
console.log(fake.textContent);
console.log(fake.innerHTML);
<p>foo<br>bar</p>