HTML comments--not specific enough

E. Stephen Mack (estephen@emf.net)
Fri, 22 Aug 1997 19:36:04 -0700


Message-Id: <3.0.3.32.19970822193604.00752c94@emf.net>
Date: Fri, 22 Aug 1997 19:36:04 -0700
To: www-html@w3.org
From: "E. Stephen Mack" <estephen@emf.net>
Subject: HTML comments--not specific enough

The section of the HTML 4.0 draft that describes how comments
are used in HTML does not go into very much detail. [1]

In particular, it doesn't warn that there are SGML prohibitions
against using two dashes (--) inside an HTML comment.  Nor does it
warn in this section that many older browsers terminate a comment
at the first > character; instead, that warning is buried at the end
of the script section [2].  At least a cross-reference should be
made.

The script section should furthermore warn that a JavaScript
decrement character may inadvertently end up illegally terminating
a comment used to hide a script, like this:

<SCRIPT TYPE="text/javascript">
  <!-- Hide script
     function decrement (var) {
       var --;
     }
  // End hiding -->
</SCRIPT>

Such a construction is certain to confuse a validator or other
user agent that is aware of the proper construction of SGML
comments.

[1] http://www.w3.org/TR/WD-html40/intro/sgmltut.html#h-2.3.2.4
[2] http://www.w3.org/TR/WD-html40/interact/scripts.html#h-9.2.2.2