3 ms·
HTML was essentially always rigorously defined through a SGML DTD. XHTML also conforms to a DTD which additionally conforms to XML which is itself a restricted
by danbruc 3y ago
HTML was essentially always rigorously defined through a SGML DTD. XHTML also conforms to a DTD which additionally conforms to XML which is itself a restricted subset of SGML. SGML offers huge flexibility, for example with regard to implicitly closing tags or redefining all kinds of aspects; you could easily replace the angle brackets with whatever you want and have your HTML document look like
(START div)Hello (START b)world\b/!\div/
why ever you would want this.
But despite all the flexibility offered by SGML and because probably nobody implemented HTML parsing by using a SGML parser, we ended up with malformed HTML documents who's interpretation was essentially defined by whatever the ad hoc HTML parser implementations in browser did.
HTML5 finally abandoned the idea of basing HTML on SGML and a DTD and instead essentially formalized the status quo of HTML parsing and put it into the specification. At least this is my understanding as a non-web developer who gets to work with HTML only occasionally.
- solardev 3y agoThe informality of HTML wasn't solely a matter of markup strictness though. There were too many differences in CSS rendering (ACID tests), Javascript runtimes, SVG and PNG rendering, scrollbar and border and frame and iframe displays, etc. With so many variables, it couldn't NOT be a browser dependent implementation. The W3C was too strict where it didn't really matter (the basic markup) and too loose where it did matter (everything else).
- danbruc 3y agoA lot of this is also hindsight. HTML started as a document markup language, so the structure was important but not the exact layout details. This was certainly considered a feature, everyone could make documents look the way they preferred. At that time probably nobody imagined that HTML would eventually be used to build controls and then entire applications out of them. Also there was no specification right from the start and the feature set was very limited, so that everyone started implementing their interpretation of HTML and adding their extensions. Trying to combine and standardize all the things existing in the wild would necessarily be a hard task. Many early extensions were probably also quite ad hoc and even if not they most likely did not take into account interactions with extensions from others. But in the end this could probably never have happened much differently, future developments and requirements could not be known in any detail and even if nobody would ever have spent a decade to write good specifications for a new technology which might or might not get adopted.
- solardev 3y agoThat's true. Very good point. The things that did try to design for the future, across platforms, failed. Java on the desktop, WPF, etc. all gave way to the simplicity of web technologies.