The retroguard returns: Some SGML comments

The otherwise honourable Acid2 test dredged up something I had hoped I wouldn’t see again. Most tests are CSS tests, parsing and layout, but they also threw in an old misfeature from HTML’s past. If you look at the test’s source code you will find “ERROR”. An HTML comment followed by “ERROR”, right? No, unlike in the more modern XML "" are not comment delimiters, “--” is. In SGML so ERROR is actually a part of a long comment. Easy to see, isn’t it?

In theory HTML is a SGML application so SGML rules apply. In practice there has never been a SGML web browser and there never will. For a long time Opera was alone in supporting some SGML-isms like “--” comment delimiters until we removed them around Opera 5 or 6, but Opera wasn’t even close to being a SGML browser so all we did was to add quirks and give no benefits.

Mozilla later made exactly the same mistake as we did and they are still doing it. This causes an interoperability problem as Mozilla will fail on this comment and other browsers don’t. The obvious solution would be for Mozilla to change their browser, but WaSP opted for the other option instead. If that view wins through web developers will be bound to count their hyphens. Any multiple of four is good, anything else is bad.

Join the Conversation

  1. title//
    p/I agree that y with SGML is a em/nosense/.
    BTW: add DOCTYPE and that’s complete, valid HTML document.

  2. Still, is a cute feature of SGML. Full SGML is close to Perl laziness (and readability). The lack of support for these features has been fortuitous.

  3. Since XML is defined to be a subset of SGML it has to follow suit. To quote: “For compatibility, the string “–” (double-hyphen) MUST NOT occur within comments.” This rule actually is stricter than SGML, since is a valid SGML comment, but a fatal error in XML. Even so this is less of a problem in XML than it is in HTML. In part because XML is expected to be anal and XML processors usually give better diagnostic error messages, but more because the error in XML is consistent while it is more insidious with SGML.XML would probably have been better off by removing the SGML compatibility requirements, as would HTML by removing the pretense of being a SGML application.

  4. Hello everybody,what jax said ist just right the point that gives to us a leading hand. If the double hyphen “–” can itself not be part of within a comment, then within one (descriptive) markup (“tags”) only one comment is allowed to appear. And SGMLies, who truely want to have a clean SGML-application, will follow this way. “One descriptive markup” I mean here as the part beetween STAGO (Start-TAG Open = “

  5. For some definition of “works”. There was an SGML browser, but I didn’t consider Softquad’s offering to be a “web browser” and they gave it up fairly soon. In a way it reminds me of Hyper-G, technically interesting but not very useable.

Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.