Re: comments (Re: Really Quick Guide to Good HTML)

Ben Breakstone (bbreak@mit.edu)
Wed, 21 Feb 96 16:46:50 EST


Date: Wed, 21 Feb 96 16:46:50 EST
Message-Id: <v02120d03ad50fb00fb38@[198.114.176.14]>
To: www-html@w3.org
From: bbreak@mit.edu (Ben Breakstone)
Subject: Re: comments (Re: Really Quick Guide to Good HTML)
Cc: boo@best.com (Walter Ian Kaye)

>>I frequently add comments to my web pages using the syntax
>>
>><!-- This is a comment -->
>>
>>My first few lines are fairly standard giving such information as my name
>>and a version number. I'm quite a bit more sparse with my comments in
>>HTML than I am in, say, C++. I guess I'm still trying to settle on a good
>>commenting style.
>
>Heh, you could always just use your C++ commenting style in a bracket. If I
>did so, mine might possibly look like this:
>
> <!--
>
<big comment snipped>
> -->

The only problem with this is that there are still some browsers out there
that don't properly handle comments, at least if they're in the <body> of
the document.  I had a few snotty little comments in the middle of some of
my web pages just for my own amusement, assuming that most people don't
look at the source.  I was shocked to see the comments rendered as if they
were a part of the page's text when I showed the page to a friend on his
machine.

I figured out that what this browser (and others, I found later) was doing
was terminating the comment sequence at the first line break.  So, while
<!-- hey, this is a comment, jerko -->
would remain invisible,
<!-- hey,
  this is a comment, jerko
-->
would show up as "this is..." in the middle of the page.  I've found at
least two browsers that do this.  My understanding is that this is
nonstandard behavior, but still, I'm keeping all my non-single-line
comments in the <head> from now on.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Breakstone      bbreak@mit.edu
http://hamp.hampshire.edu/~bjbF94/
      For PGP public key,
finger bjbF94@hamp.hampshire.edu