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

Received on Friday, 22 August 1997 22:35:33 UTC