Re: Hyphens in comments

On Thu, 21 Mar 2002, Christian Smith wrote:

> > However, the validator doesn't complain about constructs like:
> >
> >    <!-------------->
>
> I'm fairly certain that if you use that exact comment in an
> HTML document the validator will complain since the comment
> never terminates.

No, that's a perfectly legal comment.  It's just unterminated,
so everything following it is in fact commented out until and
unless the parser encounters another "--".

What happens after that will *probably* generate errors, but these
will be quite misleading, since they point to an altogether different
part of the document.

The moral of this is that you really do need to look at the parse
tree.  At this point I should insert the customary plug for Valet,
whose presentation will lead to less confusion in these cases.

> > in HTML mode. Now I wonder: *Is* that allowed, or is it not?...
>
> It is allowed if you are careful and ensure that you use
> multiples of 4 hyphens and only put content in between
> matched pairs.
>
> <---- --this is valid-- ---->
>
> <----this is not---->

Again not entirely correct.  Your second example *may be* valid,
again depending on the context in which it arises.  However, the
words in it are not a comment.

-- 
Nick Kew

Site Valet - the mark of Quality on the Web.
<URL:http://valet.webthing.com/>

Received on Thursday, 21 March 2002 13:57:35 UTC