Re: Simple(?) comments question...

Arnoud "Galactus" Engelfriet wrote:
> 
> Just had a discussion with someone who wanted to know if a "-" can be
> used as the last character in a comment. I would say yes, since a
> comment is terminated by TWO "-" characters. However, is the following
> comment valid?
> 
> <!-- Hello--->
> 
> Should a parser consider the first of the three "-"s as the last
> character of the comment's text, or consider "->" to be out-of-bounds
> text or something?

My impression is that this is not a correctly terminated comment, since
it does not fit the strict definition given in RFC1866.  However,
that's irrelevant, as all 3 browsers I've tried it on accept it. 

A further question is, what is the parser to make of any such text not
held between the comment markers?  eg.

<!-- My Comment -- h1 -- start a level one heading? -- align=center -- put
it in the middle? -->

My parser ignores such things.  Should it?

My feeling is that the whole comment issue became complicated because
the syntax was inherited from SGML.  Also that error in the early HTML
draft that incorrectly stated that '>' was sufficient to terminate a
comment has not helped.  This issue has forced me to spend more time
working on the comment parsing in my (custom written in C) parser than
any other part of the HTML syntax. :-(

-- 
Stewart Brodie, Electronics & Computer Science, Southampton University.
http://www.ecs.soton.ac.uk/~snb94r/      http://delenn.ecs.soton.ac.uk/

Received on Wednesday, 18 September 1996 05:22:50 UTC