W3C home > Mailing lists > Public > public-html@w3.org > November 2007

Re: Proposal for developing HTML 5 materials for Web *authors*

From: Shawn Medero <soypunk@gmail.com>
Date: Wed, 21 Nov 2007 10:44:52 -0500
Message-ID: <994fc8d00711210744v4ec09281jb7c860f2d18976df@mail.gmail.com>
To: "Dean Edridge" <dean@55.co.nz>
Cc: "Anne van Kesteren" <annevk@opera.com>, "Maciej Stachowiak" <mjs@apple.com>, "HTML WG" <public-html@w3.org>

On Nov 21, 2007 10:16 AM, Dean Edridge <dean@55.co.nz> wrote:

> Surely it's not too hard to use:
>
> <script src="js/ufo.js" type="text/javascript"></script>

Ian Hickson covered this topic nicely via http://www.hixie.ch/advocacy/xhtml:

 * <script> and <style> elements in XHTML sent as text/html have to be
   escaped using ridiculously complicated strings.

   This is because in XHTML, <script> and <style> elements are #PCDATA
   blocks, not #CDATA blocks, and therefore <!-- and --> really _are_
   comments tags, and are not ignored by the XHTML parser. To escape
   script in an XHTML document which may be handled as either HTML4 or
   XHTML, you have to use:

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

   To embed CSS in an XHTML document which may be handled as either
   HTML4 or XHTML, you have to use:

      <style type="text/css"><!--/*--><![CDATA[/*><!--*/
        ...
      /*]]>*/--></style>

   Yes, it's pretty ridiculous. If documents _aren't_ escaped like
   this, then the contents of <script> and <style> elements get
   dropped on the floor when parsed as true XHTML.

   (This is all assuming you want your pages to work with older
   browsers as well as XHTML browsers. If you only care about XHTML
   and HTML4 browsers, you can make it a bit simpler.)
Received on Wednesday, 21 November 2007 15:45:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:09 GMT