Terrence Wood wrote:
Lachlan Hunt said:
In SGML, the comment syntax is as follows:
I believe your original comment was that it was invalid HTML. While
similar, the SGML rule differs from HTML in it's treatment of whitespace,
There is no formal difference between HTML4 and SGML comments, as HTML
is an application of SGML which follows SGML rules. On the practical
side of things, however, browsers will handle various forms of invalid
comments in various ways, but that doesn't make them any less invalid,
nor alter the formal HTML comment syntax.
and the example you provided is, in fact, invalid HTML.
Note that I broke the comment onto multiple lines in order to explain
each component clearly, and I did mention that whitespace could not
follow the MDO and that only whitespace could occur between comments. I
thought it was clear that the notes in parenthesis were just that, and
not actually part of the comment.
The recommendation[1]
That part of the rec should be treated as being informative, rather than
normative.
goes on to say authors should avoid multiple hyphens
together in comments, however mulitple hyphens do not invalidate the
document (otherwise, I presume, the recommendation would read MUST avoid
multiple hyphens, and the validators would flag multiple occurances of
them).
It says *should* because it still uses SGML comment syntax, but authors
should avoid using it because a) browser support is limited (and was
much more limited at the time of writing) and b) most authors are
unlikely to understand the SGML comment syntax, and it's advisable for
authors to simply avoid strings of hyphens, rather than worry about all
the technical details. If it said *must*, then that would not comply
with SGML rules.
eg.
<!-- this is ---- a valid -- -- comment declaration -->
<!-- this -- is not -- valid -->
Run those through the validator to confirm that, if you like.
[1] http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4
--
Lachlan Hunt
http://lachy.id.au/
******************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************