Re: Over-tidying <TR>'s

On Mon, 17 Jan 2000 susan_levine@peoplesoft.com wrote:

> Hi Tidy People--
> 
> 
> Tidy doesn't like script tags inside a <tr>.  It chooses to move it to
> before the <table> tag.  The problem is that my <script> tag references an
> image defined above it using the javascript DOM, so that when it's moved to
> before the table, it gets an undefined object error when it executes.  I
> can't find anything in the HTML spec that specifically prohibits the
> <script> tag from living within the <tr> (or any other tag).  I believe my
> HTML is correct, and Tidy is providing an unnecessary clean up.
> 
> Is this something you can (or would be willing to) fix, or is there some
> specification that says script tags can only be defined within the <body>
> tag?
> 
> I am actually experiencing this problem with the Java version of Tidy, but
> Andy Q. does not want to deviate from your functionality.
> 
> 
> 
> My HTML looks like this:
> 
> <table>
>     <tr>
>         <td>
>             <IMG WIDTH=240 HEIGHT=20 NAME=processing src='IMAGE1.gif'>
>         </td>
>         <SCRIPT LANGUAGE='javascript'>
>           document.processing.src = 'IMAGE2.gif';
>         </SCRIPT>
> 
>     </tr>
> </table>

This is indeed illegal. The simplest fix is to move the script into
the table cell. You could also rewrite your script to avoid the
processing error.

Tidy isn't smart as a human and doesn't have enough common sense to
"know" that this is a good thing to do. For instance, it doesn't
understand hardly anything about JavaScript.

Regards,

-- Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
tel/fax: +44 122 578 3011 (or 2521) +44 385 320 444 (mobile)
World Wide Web Consortium (on assignment from HP Labs)

Received on Tuesday, 18 January 2000 04:13:14 UTC