W3C home > Mailing lists > Public > www-validator@w3.org > February 2009

Bug in HTML 4.01 Test: JavaScript is checked?

From: Daniel Marschall <info@daniel-marschall.de>
Date: Wed, 18 Feb 2009 00:07:17 +0100
Message-ID: <A9CA50623DAF4F97A022F8C1F3E2B69B@ako>
To: <www-validator@w3.org>
Dear Sir or Madam.

I think I have found a bug in the validator check tool.

I made a Anti-Spam-Mechanism which outputs following html code:

<script language="JavaScript" type="text/javascript"><!--
document.write("<a href=\"");document.write("&#109;");document.write("&#97;");document.write("&#105;");document.write("&#108;");document.write("&#116;");document.write("&#111;");document.write("&#58;");document.write("&#105;");document.write("&#110;");document.write("&#102;");document.write("&#111;");document.write("&#64;");document.write("&#101;");document.write("&#120;");document.write("&#97;");document.write("&#109;");document.write("&#112;");document.write("&#108;");document.write("&#101;");document.write("&#46;");document.write("&#99;");document.write("&#111;");document.write("&#109;");document.write("\">");document.write("&#105;");document.write("&#110;");document.write("&#102;");document.write("&#111;");document.write("&#64;");document.write("&#101;");document.write("&#120;");document.write("&#97;");document.write("&#109;");document.write("&#112;");document.write("&#108;");document.write("&#101;");document.write("&#46;");document.write("&#99;");document.write("&#111;");document.write("&#109;");document.write("</a>");// --></script>

Note: This is a JavaScript, it should be ignored by the validator! It has no line breaks to make it a bit more complex.

Now, let's put the code into a valid (X-)HTML page and check it with W3C-Validator.

When checked as XHTML 1.0 Transitional: Valid!
When checked an HTML 4.01 Transitional: NOT valid!

It says, that the closed Tag </a> was not opened. But this </a> is inside the <!-- and --> because of the JavaScript! So, it should not be an error!

So, what can I do, that my HTML 4.01 document is detected as valid? Or is it a bug of W3C that should be solved?

Best regards,
Daniel Marschall
Received on Wednesday, 18 February 2009 14:19:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:34 GMT