Re: <![CDATA[ ... ]]> and HTML Elements

William McKee <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
On Mon, Nov 08, 2004 at 09:00:12PM +0000, Fergal Daly wrote:
> That's definitely a problem but I don't see the connection with CDATA. I
> just tried

If you comment out the CDATA sections, they will work (HTML Tidy even
does this for you when it adds CDATA sections to inline Javascript).

> <script type="text/Javascript" language="Javascript">
  //<![CDATA[
>   var d;
>   d = '1' & '1';
>   alert(d);
  //]]>
> </script>


> I generally do
> 
>  <snip>
> 
> Petal seems to leave that alone and it's the standard way of doing things
> even when Petal isn't involved

Ahhh, that's what Jean-Michel did to add better support for JavaScript.
I remember him telling the list that he had made a release with better
support. However, I'd since stopped using the // <!-- // --> comments
since they are mostly unnecessary.

Since that workaround is in place, it doesn't seem like it'd be hard to
add a similar workaround for CDATA which is gaining more usage, esp
since HTML Tidy wraps style tags and JavaScript sections in them. What
do you think?


> There's also nothing to stop you closing the comment tag in the middle,
> putting in some Petal and then starting again. It's not the prettiest in the
> world but it works. Hope that helps,

Good point. Very useful discussion.


William

-- 
Knowmad Services Inc.
http://www.knowmad.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.