4 ms·
You can still write the HTML5 vocabulary as XHTML if you really want to. That's perfectly valid, and defined in the spec. The HTML5 parsing algorithm is what t
by wilhelm 16y ago
You can still write the HTML5 vocabulary as XHTML if you really want to. That's perfectly valid, and defined in the spec.
The HTML5 parsing algorithm is what the browser vendors want and need, however. Since HTML was never specified properly - not even in HTML4, where large areas were just undefined - HTML parsers have slowly evolved through trial and error. If big sites depend on a particular behaviour in a particular browser, other browsers have tried to be bug-compatible with that browser. Browsers that failed to do so have lost market share. If a browser decided to halt on encountering anything invalid would lose all of its users instantly, since the vast majority of documents are invalid.
Parsers have slowly converged towards each other, and the HTML5 algorithm is the compromise between them that breaks the last amount of content.
In other words, the goal of the HTML5 parsing spec was never to make something nice and clean. The goal was to define how to parse the unholy mess all you web developers out there have created during the past two decades. A clear spec, a good test suite and exactly identical behaviour between browsers is a benefit for everyone.
- eru 16y agoI agree. But: Why do we need exactly identical behaviour? Wasn't HTML intended to leave lots of discretion for rendering decisions to the browser?
- wilhelm 16y agoIf you parse a string of bytes, it's nice if it always turns into the same DOM. That's the scope of the HTML5 parser. There is no benefit to inconsistencies here. Allowing browsers on different platforms to adjust page widths, font sizes, whether or not load images and plugins in accordance with the user's preferences is fine, but that's an entirely different issue.
- eru 16y agoThanks for the clarification.