[Petal] <![CDATA[ ... ]]> and HTML Elements

William McKee william at knowmad.com
Mon Nov 8 18:41:40 GMT 2004


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


More information about the Petal mailing list