W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

Fw: hyphens in comments in script tags

From: slim <slim@voltage.net>
Date: Wed, 2 Aug 2000 13:10:23 -0500
Message-ID: <001b01bffcac$ee1521c0$2404bdd0@net>
To: <html-tidy@w3.org>


how do I delete tidy      sold the machine          Thanks




----- Original Message -----
From: "Randy Waki" <rwaki@flipdog.com>
To: <html-tidy@w3.org>
Sent: Wednesday, August 02, 2000 11:51 AM
Subject: RE: hyphens in comments in script tags


> Erik Severinsen wrote:
> >
> > Despite using the 'fix-bad-comments: true' setting the HTML comment
inside
> > the script tag isn't cleaned as hoped. The multiple hyphens (---) stops
my
> > XSL-transformation as '--' is not valid XML. Isn't Tidy suppose to
handle
> > this. I'm using JTidy ver. 8jul
> >
> > <script type="text/javascript" language="javascript">
> > <!--
> > myRandomNum = Math.round(10000*Math.random())
> > //--- Preload Images ---//
> > var idx;
> > var check;
> > var maxImages = 14;         // Number of images to preload.
> > var rollImg = new Array();
> > for(idx=0; idx < maxImages + 1; idx++)
> > {
> >     rollImg[idx] = new Image();
> >     if (idx == 0)
> >         rollImg[idx].src = "/gfx/lc_glbnetwork_usaflag.gif";
> >     if (idx == 1)
> >         rollImg[idx].src = "/gfx/lc_glbnetwork_dkflag.gif";
> >       if (idx == 11)
> >         rollImg[idx].src = "/gfx/lc_glbnetwork_no.gif";
> > }
> > //-->
>
> The problem is the -- operator.  For example, the for loop in your
> example might have been counting down instead of up.  You wouldn't want
> Tidy to change idx-- into idx==.  I don't believe you can represent
> the -- operator inside a comment that's both legal XML and is recognized
> by JavaScript.  So Tidy has to leave it alone.
>
> The only solution is to pull the JavaScript out of the comment and put
> it in a CDATA section.  Gary L Peskin posted some changes to do this a
> few weeks ago.  Search the Tidy archives at
>
>    http://lists.w3.org/Archives/Public/html-tidy/2000JulSep/thread.html
>
> for "CDATA".  Beware that the results might get rendered improperly by
> non-JavaScript aware browsers, assuming you wanted the resulting XML to
> be renderable as "backwards compatible" XHTML.
>
> --Randy
>
>
>
Received on Wednesday, 2 August 2000 14:10:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT