I don’t have much experiences in writing HTMLs.
As I know, some errors won’t be complained by the morden web browsers, like:
<html>
<ol>
<li> ordered item 1
<li> ordered item 2
</ul>
<ul>
<li> unordered item 1
<li> unordered item 2
</ul>
</html>
Instead of reporting the mismatching error between <ol> and </ul>, it will render the page as below:
- unordered item 1
- unordered item 2
I am wondering:
Will web browsers render the webpage anyway, no matter what errors are there in the HTML?
i.e.
In which situations, the web browsers will complain the errors in the HTML?
Further, Is this no-error-reporting required by HTML5 specification?
In the HTML serialization, modern browsers follow a parsing algorithm designed to be tolerant of mark up errors, and will render whatever it makes of the complete input stream.
In the XHTML serialisation, the parsing must follow XML parsing rules. This means that if and when it encounters a well-formedness error, it must stop parsing the input stream. The browser is not required to report an error (Firefox does, IE9 doesn’t), and may choose to simply render whatever DOM it has built at the point where it had to stop parsing, and remain HTML5 conforming.
Browsers do not, in practice, report errors, except for XML well-formedness errors when using the XHTML serialization, and then only sometimes. If they did, then they are telling the user, who is not the least bit interested in whether the author made a mistake when the page was written. All the user wants is access to the content.
No it isn’t. Browsers are entitled if they so wished to report such errors. The HTML serialization parsing algorithm is quite clear about when a error occurs. In the case of your mark up, the relevant rule says:
Then the rules for handling parse errors does not require browsers to either report them or not report them. Validators are required to report at least one such parse error,