At 12:24 AM +0200 7/14/04, Wouter Zoons wrote:
Hi Joe,

Yes the content-type is properly set (after some investigation your
concern crossed my mind too), but I don't think this is the problem
anyway...

The purpose of the CDATA is to have the XML parser ignore any escape
characters such as & but unfortunately the javascript parser pickes
up that same CDATA item and fails to interpret it (that's why the simple
solution of having javascript comment to have javascript ignore the
cdata part), please note we are in a <script>...</script> section

I honestly cannot see how this would work without the comment..

Well, if the browser is truly compliant, then there should be no separate "javascript parser" that would be confused by the CDATA; the browser would pull the text content of the script element after processing it as normal XML, which would mean that the CDATA would have "disappeared."


However, I did a little googling and see that there are browsers that treat XHTML as if it's really more like a kind of HTML, and therefore in some cases the comments strategy you suggest is useful.

I would be ok with adding the javascript comments when CDATA is true, but it might be worth waiting a day or two to see if any developers would consider that not correctly standards-compliant or something. Perhaps you could open a Bugzilla ticket (http://issues.apache.org/bugzilla/enter_bug.cgi?product=Struts)


Best regards
-- Wouter

 -----Original Message-----
 From: Joe Germuska [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 14, 2004 12:02 AM
 To: Struts Developers List
 Subject: Re: HTML taglib: javascript

>this is all fine for XHTML, but the browser's javascript engine does
not
 >seem to like it.. Firefox complains silently (you can check it on the
 >Javascript console) and IE shows a dialog (unless you unchecked that
 >option), the problem is that the CDATA is being interpreted as
 >javascript

 Are you sending your pages to the browser with the right content
 type?  I believe it would be "application/xhtml+xml"

 If your server is identifying that it's sending "text/html" then the
 browser might get confused by CDATA.

 I haven't used XHTML very extensively, so I may be off here.

 Joe

 --
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
 "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
 back; I'll know I'm in the wrong place."
     - Carlos Santana

 ---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll know I'm in the wrong place."
- Carlos Santana


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to