W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2002

RE: HTML-KIT 292 TIDY problem with JavaScript code

From: Richard Norman <normri@samc.com>
Date: Fri, 06 Dec 2002 16:57:01 -0800
Message-Id: <sdf0d6de.015@samc.com>
To: <html-tidy@w3.org>

In regards to this question,  is it good HTML practice to escape all
your script tags with a CDATA markers?
 
I started doing my script tags like the following
 
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
 
/*]]>*/
</script>
 
If this is incorrect, please let me know.  I was in the process of
trying to conform more to the standards and I read somewhere that you
should escape your Script sections with the CDATA directive.  Below I am
showing the doctype I used...
 
<!DOCTYPE html PUBLIC
 "-//W3C//DTD XHTML 1.0 Transitional//EN"
 " HYPERLINK
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" HYPERLINK
"http://www.w3.org/1999/xhtml"http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
 
Thanks..
 
Richard Norman
 
P.S. When I sent the file to the validator, it ended up passing as
valid...

-----Original Message-----
From: "Dave Cannarella" <dave.cannarella@horizonair.com> 
Sent: Friday, December 06, 2002 4:20 PM
To: <html-tidy@w3.org>
Subject: HTML-KIT 292 TIDY problem with JavaScript code




I just downloaded HTML_KIT build 292 and have some TIDY problems that
did not 
occur in build 290. I received error and warning messages in JavaScript
code 
that is being interpreted as HTML. Do you have any suggestions? Below is
sample 
code. 
<!DOCTYPE HTML PUBLIC "_//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>Sierra Club Loowit Group Get Outdoors</title> 
<script language="JavaScript" type="text/javascript"> 
<!__ 
function MM_preloadImages() { //v3.0 
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++) 
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 
function MM_findObj(n, d) { //v4.01 
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) { 
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) 
x=d.forms[i][n]; 
for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
x=MM_findObj(n,d.layers[i].document); 
if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 
//__> 
</script></head> 
<body bgcolor="#FFFFFF" text="#000000"> 
Hello world 
</body> 
</html> 
Below are errors and warnings: 
'<' + '/' + letter not allowed here 
unescaped & which should be written as &amp; 
unescaped & or unknown entity "&parent.frames.length" 
unescaped & or unknown entity "&i" 


--- 
Incoming mail is certified Virus Free. 
Checked by AVG anti-virus system ( HYPERLINK "http://www.grisoft.com"
\nhttp://www.grisoft.com). 
Version: 6.0.423 / Virus Database: 238 - Release Date: 11/25/2002 
  


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.423 / Virus Database: 238 - Release Date: 11/25/2002
 

**************************************************************************************************
The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or  the 
sender immediately and do not disclose the contents to any one or make copies.

**************************************************************************************************
Received on Friday, 6 December 2002 19:58:08 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:39:48 UTC