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 05:00:34PM +0000, Fergal Daly wrote:
> On Mon, Nov 08, 2004 at 11:16:08AM -0500, William McKee wrote:
> > On Mon, Nov 08, 2004 at 12:50:59PM +0000, Chris Croome wrote:
> > > This has come up before with respect to javascript, what should
> > > petal do, not touch things in CDATA sections?
> > 
> > I think this would be a good solution.
> 
> Petal's current behaviour is correct.

Fergal,

I have no doubt you are right regarding the behavior of Petal. However,
the correct behavior is not always the optimal behavior. Here's an
example of a JavaScript that will fail when passed through Petal:

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

The '&' which does a comparison in the same way that Perl's own && gets
converted to &amp;. Unfortunately, the browser does not treat this
entity as a comparison operator.

Any advice on how to make this work without using an external Javascript
file would be appreciated.


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.