W3C home > Mailing lists > Public > www-validator@w3.org > October 2005

Re: BUG - Reading Java variable as an invalid comment declartion

From: David Dorward <david@dorward.me.uk>
Date: Wed, 5 Oct 2005 10:12:13 +0100
To: David Hirst <cepeleon@yahoo.com>
Cc: www-validator@w3.org
Message-ID: <20051005091213.GA816@us-lot.org>

On Wed, Oct 05, 2005 at 01:59:05AM -0700, David Hirst wrote:
> http://www.w3schools.com/js/js_howto.asp
> Says you should wrap javascript like this for older
> browsers.

Older browsers in this case means "Netscape 2". Its safe to forget
about these days. It also applies to HTML, not XHTML. To do something
similar in XHTML you need to do something along the lines of:

      <script type="text/javascript"><!--//--><![CDATA[//><!--

                      (see http://www.hixie.ch/advocacy/xhtml)

Its usually a better idea to just stick to HTML 4.01.

> And as the validator is picking up '---' as
> the end tag 

Its a comment, not a tag.

   White space is not permitted between the markup declaration open
   delimiter("<!") and the comment open delimiter ("--"), but is
   permitted between the comment close delimiter ("--") and the markup
   declaration close delimiter (">"). A common error is to include a
   string of hyphens ("---") within a comment. Authors should avoid
   putting two or more adjacent hyphens inside comments.

      -- http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4

> when it should read --> to me that means,
> no the variable is not a comment and the validator is
> wrong unless of course this page on w3schools needs to
> be updated, and it now sounds like it does.

W3Schools has many errors and I generally recommend that it be
avoided. It is in no way affiliated with the W3C.

> I take it then from what you say the javascript should
> be quoted as such?

Looks about right, but I put all my JavaScript in external files. It
saves a lot of trouble.

David Dorward                                      http://dorward.me.uk
Received on Wednesday, 5 October 2005 09:12:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:46 UTC