Comment by bazoom42
1 day ago
If you forget a closing quote on an attribute in html, all content until next quote is ignored and not rendered - even if it is the rest of the page. I dont think this is more helpful than an error message. It was just simpler to implement.
Let's say you forget to close a <b></b> element.
What happens?
Even today, after years of better error messages, the strict validator at https://validator.w3.org/check says:
What is line 22?
It's up to you to go hunting back through the document, to find the un-closed 'b' tag.
Back in the day, the error messages were even more misleading than this, often talking about "Extra content at end of document" or similar.
Compare that to the very visual feedback of putting this exact document into a browser.
You get more bold text than you were expecting, the bold just runs into the next text.
That's a world of difference, especially for people who prefer visual feedback to reading and understanding errors in text form.
Try it for yourself, save this document to a .html file and put it through the XHTML validator.
You can have catastrophic parsing errors with the “lax” HTML too. For instance:
Or:
For reference, observe what happens if you try opening this malformed document in a browser: save it with a .xhtml extension, or serve it with MIME type application/xhtml+xml.
Firefox displays naught but the error:
Chromium displays this banner on top of the document up to the error:
Thanks for showing these. We can see Firefox matches the same style of accurate but unhelpful error message.
Chromium is much more helpful in the error message, directing the user to both line 19 and 22. It also made the user-friendly choice to render up to the error.
In the context of XHTML, we should also keep in mind that Chrome post-dates XHTML by almost a decade.
1 reply →