Incorrect script excise from table (was Re: possible jtidy changes)

ok, I'll add a little bit more light on this subject - it seems that when
I have a script element w/ a body that is not a comment and is the
only child under a table element, the script element is excised from the
table but the contents/children are left inside of the table.

I've tried this on both the jan. and august release of the C version of
tidy & on w/ jtidy & they all behave identically...

the following file
<html>
  <body>
    <table>
        <script language=JavaScript>
function email()
{
address=document.emailform.emailinput.value;
location='http://www.cnn.com/EMAIL/index.html?'+address;
}
        </script>
    </table>
  </body>
</html>

becomes

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title></title>
</head>
<body>
<script type="text/javascript" language="JavaScript">
</script>

function email() { address=document.emailform.emailinput.value;
location='http://www.cnn.com/EMAIL/index.html?'+address; }
</body>
</html>


but - when there's more to the table, and the table isn't being excised,
here's what happens

<html>
  <body>
    <table>
      <tr>
        <td>
        </td>
      </tr>
      <tr>
        <script language=JavaScript>
function email()
{
address=document.emailform.emailinput.value;
location='http://www.cnn.com/EMAIL/index.html?'+address;
}
        </script>
    </table>
  </body>
</html>

becomes

<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title></title>
</head>
<body>
<script type="text/javascript" language="JavaScript">
function email()
{
address=document.emailform.emailinput.value;
location='http://www.cnn.com/EMAIL/index.html?'+address;
}
        
</script>

<table>
<tr>
<td></td>
</tr>
</table>
</body>
</html>

where the script element still has the script.  This seems like a bug to
me, & I'd gladly fix it unless somebody tells me that it shouldn't be...

-greg

On Thu, 16 Nov 2000, Sami Lempinen wrote:

> Greetings,
> 
> I am cc'ing your message to the html-tidy list in order to discuss
> this in relation to the C version. New features should be implemented
> in the C version first and then ported to JTidy to keep the two
> versions in sync.
> 
> Could a Tidy user (C version) please verify that this problem is
> present there also? If yes, should it be altered?
> 
> Thanks!
> 
> -Sami
> 
> On Wed, Nov 15, 2000 at 12:05:12PM -0500, Gregory C. Schohn wrote:
> > hi, we're using tidy here to kosherize webpages into xml & we're having
> > a problem w/ script tags.  I'm willing to make patches for them, provided
> > that they'd make it into the source tree (so that we don't need to worry
> > about maintenance).
> > 
> > I haven't looked at the source yet (not really), but here are the
> > problems.  The first is the script tag, when the script is not enclosed
> > inside of a comment (example: www.cnn.com/index.html - function "email").
> > After running tidy (w/ a couple of different configurations) the function
> > gets excised from the script node & the text is placed immediately after
> > the end tag.  As far as I can tell on limited cases, scripts are always
> > excised when the bodies are not enclosed w/in comments.  I'd like to fix
> > that (I would think that a proper way to handle it would be to find
> > <script> & </script> and place _everything_ in between under a script
> > element).
> > 
> > Please let me know if this would be  a worthwhile addition & if there are
> > any particular ways that I should go about making it (& how the C version
> > fits in, I'd rather not make 2 changes, but I could).
> > 
> > thanks,
> > Greg
> 
> -- 
> lempinen@iki.fi http://www.iki.fi/lempinen/
> ICQ:19002710  *************  apt-get a life
> 

Received on Thursday, 16 November 2000 14:11:04 UTC