W3C home > Mailing lists > Public > www-validator@w3.org > August 2004

Re: Java script and validator... not the common endtag/backslash error

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sun, 22 Aug 2004 08:40:17 +0300 (EEST)
To: Jari Porola <jariporola@yahoo.com>
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0408220827020.1231@korppi.cs.tut.fi>

On Sat, 21 Aug 2004, Jari Porola wrote:

> > The theoretical option is a CDATA section. The
> > practical way (if you care
> > about IE, for example, which is XHTML ignorant and
> > doesn't grok CDATA
> > sections either) is to use workarounds that avoid
> > the constructs that
> > trigger something in #PCDATA parsing.
>
> Both ways seemed to work, but since I have lots of
> those triggering characters I think the CDATA is
> easier way.

Well, they work in the sense of making the document valid
(in the technical XML sense).
But as I wrote, CDATA sections don't work on IE. If you try

<script type="text/javascript"><![CDATA[
  document.write('hello');
]]></script>

you will get just a syntax error on IE, which does not recognize
the <![CDATA[ construct, and therefore doesn't read the
JavaScript code properly.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Sunday, 22 August 2004 05:40:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:08 UTC