W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2000

Re: clean XHTML : what's new?

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Thu, 14 Dec 2000 21:07:15 +0100
Message-ID: <002001c06609$75ec67a0$c7e0a8c0@de>
To: "philippe barthelemy" <philippe.barthelemy@bdesign.fr>, <html-tidy@w3.org>
* "philippe barthelemy" <philippe.barthelemy@bdesign.fr> wrote:
| XTML requires a CDATA section within a <script> block,

Thats not correct. XML does not know content model CDATA for Elements, so the
content of a script element is interpreted as markup. To keep the script
readable, one could use a CDATA section, but there is no must to do so, you
can use

  if (a &lt; b)

too. Further, this is only necessary if the script includes characters, that
need to be escaped.

The problem is, that current browsers don't know CDATA sections and ignore the
script completly. I've suggested the following to get around this:

  <script type="text/javascript">
  <!-- --> <![CDATA[ /> <!--

    for (var i=0; i < 10; i++) { ... }

  // --> <! ]]>
  </script>

Tidy should offer an option to extract the script and put it into a seperate
file.
--
Björn Höhrmann ^ mailto:bjoern@hoehrmann.de ^ http://www.bjoernsworld.de
am Badedeich 7 ° Telefon: +49(0)4667/981ASK ° http://bjoern.hoehrmann.de
25899 Dagebüll # PGP Pub. KeyID: 0xA4357E78 # http://learn.to/quote [!]e
  "Everything we see or seem is but a dream within a dream" - E.A. Poe
Received on Thursday, 14 December 2000 15:06:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT