Saturday, October 19, 2019

html - Why do browsers append extra line breaks at the end of the body tag?

When loading an HTML document I find that the DOM body content is inconsistent with the body content in the HTML document.



For example, if you go to example.com the end of the HTML document looks like this:








I would expect the last child node of body to be \n.




However, when I access the DOM in JavaScript the textContent of the last child node is \n\n\n.



I tried this in Chrome and Firefox and both behave in the same way. What is the explanation for this behavior?

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...