I read the following in HTML 5 tag reference at W3School
HTML5 improves interoperability and reduces development costs by
making precise rules on how to handle all HTML elements, and how to
recover from errors.
While I understand that there are some attributes like “pattern” and “required”, are they talking about the same? Do they mean form validation when they mention “recovery from error”?
If not, what HTML 5 elements/tags are they referring to which helps “recovering from error”?
Thanks
From the source: http://dev.w3.org/html5/spec/Overview.html#an-introduction-to-error-handling-and-strange-cases-in-the-parser
HTML 5 defines a standard for the the handling of specific exceptional situations.
Why it’s important
I have written a few HTML parsers for commercial use and–while no means an expert on the subject–I know firsthand how painful it can be to deal with malformed content. As hard as developers try (or fail to try), many major sites have poor, non-standard markup. Content management systems driven by non-technical users only increase the problem, as most WYSIWYG editors don’t produce perfect markup.
So what do you do? you make assumptions and you relax the rules, rather than failing the whole process or rendering radically incorrect content when you know that was probably not the intention of the developer.
The HTML spec (versions 5 and previous) define rules for how user agents should handle the rendering of content. To my knowledge, the HTML 5 spec has the richest definition for how exceptional cases should be handled.
If all user agents (browsers) treat exceptional cases the same, you achieve consistency while still allowing for the inevitable human error. That said, I wish more people would take the warnings on validator.w3.org seriously (or at least read them!)
FWIW, most people on this site (myself included) don’t trust w3schools as a reference.