3 ms·
I've reported results of my SGML DTD for W3C HTML 5.2 vs existing test suites for HTML in [1] (the "TALK" slides). That's more than can be said for almost all H
by tannhaeuser 4y ago
I've reported results of my SGML DTD for W3C HTML 5.2 vs existing test suites for HTML in [1] (the "TALK" slides). That's more than can be said for almost all HTML5 parsers, including those of browsers. You have to keep in mind that test case suites for HTML are hopelessly out of sync with the spec text; W3C's nu validator for HTML 5 doesn't even reference a version/commit (and what version should it reference anyway when WHATWG's "living standard" is just a stream of consciousness without publication dates and versions after all, written by Chrome devs?).
People (like you ;) have this idea that HTML is "tag soup" but it just isn't. It's almost all bog standard SGML, and explained in great detail in [2], obscured by WHATWG HTML having very generous recovery rules accepting almost any byte sequence as HTML.
Citing a previous comment I made when that came up about a year ago here:
HTML is basically SGML with a DTD declaring rules for tag omission/inference, empty elements, and attribute shortforms. This is what the majority of XML heads seem to struggle with, but which nevertheless is every bit as formal as XML is, XML being just a proper subset of SGML, though too small for parsing HTML.
Then HTML has a number of historical quirks including:
- the style and script elements have special rules for comments that would make older pre-CSS, pre-Javascript browsers just see markup comments and ignore those
- the URL syntax using & ampersand characters needs to be treated special because & starts an entity reference in SGML's default concrete syntax
- the HTML 5 spec added a procedural parsing algorithm (in addition to specifying a grammar-based spec) that basically parses every byte sequence as HTML via fallback rules; for most intents and purposes, the language recognized by these rules, taken to the extreme, is not what's commonly understood as HTML
- WHATWG have added a number of element content rules on top of the HTML 4.01/HTML 5.0 baseline with ill-defined parsing rules (such as the content models for tables and description lists); the reason is precisely that WHATWG, once Ian Hickson had distilled the HTML DTD 4.01 grammar rules into the HTML 5 grammar presentation as prose, a formal basis was no longer used for vocabulary extension
[1]: http://sgmljs.net/docs/sgml-html-tutorial.html http://sgmljs.net/docs/sgml-html-tutorial.html
[2]: http://sgmljs.net/docs/html5.html http://sgmljs.net/docs/html5.html