Question

I was going through someone's .asp code and saw that he was printing a HTML without closing it. I went to Chrome and in its inspector to see the DOM and where to close it when out of the sudden there it was: the tag!!

I went back to .asp to check if I missed something, but there were no html includes or .js that would be closing it. I thought I was going crazy and then a colleague of mine told me that some Browsers are closing unclosed tags by themselves?!

It makes sense regarding all the bad code out there but...

Inspector has the tag, but the real HTML source code doesn't so I assume Chrome reads the source code, magically adds closing tags and then presents the page. Chrome inspector, then, inspects the magically changed version.

My questions are:

  • why would a developer tool like C. inspector show the modified version?

  • how to turn it of ?

  • what else is autoclosed except tag

Thanks a lot

Was it helpful?

Solution

What you see in the inspector (same goes for firebug) is the browser-interpreted (or rendered) version of the given source not the real source.

why would a developer tool like C. inspector show the modified version?

If error checking were too strict, a lot of webpages wouldn't be viewable at all.

how to turn it of ?

I don't think that's possible.

what else is autoclosed except tag

Everything the browsers needs to get a wellformed html-source.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top