W3C home > Mailing lists > Public > www-validator@w3.org > January 2019

False warning in HTML5 verifier

From: Steve Glennie-Smith <sgs@stevegs.com>
Date: Mon, 21 Jan 2019 21:51:27 +0000
To: www-validator@w3.org
Message-ID: <36c32c641742190765256085415f7a93@stevegs.com>
Hello, 

I generally find your verifier very useful.  However, it seems to have
problems with tags embedded within JavaScript.  It gave an invalid
warning saying a 4-column table row only had 3 elements because the 4th
column was declared within a document.write <script> section.  The code
was: 

<tr>
  <th colspan="3">Tax:
  <script>
    if (overpaid)
        document.write (' overpaid<\/th><td class="red">');
    else
        document.write (' due<\/th><td class="total">');
    var amount = 40.73;
    document.write ('&pound;' + amount + '<\/td>');
  </script>
</tr> 

As you can see, the <th> tag was closed and the 4th column <td> tags
were opened and closed within the script.  It seems to be happy that the
<th> tag was closed but didn't 'see' the <td> tags.  If I put the
closing </td> tag outside the script, it flagged an error citing a stray
</td> tag. 

Regards,
Steve Glennie-Smith
Received on Tuesday, 22 January 2019 08:27:15 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:00:08 UTC