Hacker News new | ask | show | jobs
by nayuki 3566 days ago
Agreed. Years ago I started doing all my projects in XHTML because I found that debugging silent HTML errors was not fun.

Silent errors include things like malformed tags and attributes, incorrect nesting structure (thus also messing up where CSS rules are applied), and unescaped left-angles and ampersands.

1 comments

This is why I've always advocated DTD-validation of HTML (which is shockingly underused).
I've never actually seen anyone validate their HTML. If you suggested this in most companies, they would look at you like you had two heads.
About a decade ago it was a pretty commonplace thing to happen.

HTML 4/4.1 was kind of messy, and could have rendering issues. So going with an (x)HTML validator was a common thing, as well as a marketable value proposal to clients.

HTML 5 had much "saner" implementations, so validators fell by the wayside as they weren't as necessary for compatibility.

A good text editor will validated against the DTD as you type. And after you publish, you can use https://validator.w3.org/
The Firefox source viewer (not the developer tools DOM viewer) does validation. It will highlight bad tags in red and if you hover over them it shows the error.
I'm pretty sure Moz has HTML validator built into its SEO tool, so it may be more common than you think solely because of that. We validate HTML at my company—If we don't we'll hear about it next time our boss runs an SEO check,
How can you validate HTML when most of the HTML these days is templated and generated dynamically?
It turns into a complete document eventually.