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

Re: html code in <script>

From: David Woolley <forums@david-woolley.me.uk>
Date: Tue, 13 Nov 2007 21:03:48 +0000
Message-ID: <473A1134.9000906@david-woolley.me.uk>
To: www-html@w3.org

Paul Kieffer wrote:

> This webpage:
> www.ucog.org/news1.php?strArticle=NEWS/2007-10-20.htm

The page is invalid XHTML, which means it is also invalid under Appendix 
C rules.  If this were served as XHTML, it would need a CDATA section 
around the script; you could also use entities to protect the "<", etc. 
  If it were served as proper HTML, best practice would be to put an 
HTML comment around the script content.  None of these options are 
available under Appendix C rules (you cannot use entities to protect 
scripts in HTML as they are implicitly CDATA sections), so you must have 
the script out of line.

By the way, I am pretty sure that document.write on the currently 
loading document is not permitted in XHTML.

My advise would be to revert to HTML 4.01 and use HTML comments to 
protect the scripts against earlier browsers.  Many people think that 
Appendix C (serving XHTML as text/html) was a bad idea; it relies on 
certain non-compliances that are common in text/html browsers.

David Woolley
Emails are not formal business letters, whatever businesses may want.
RFC1855 says there should be an address here, but, in a world of spam,
that is no longer good advice, as archive address hiding may not work.
Received on Tuesday, 13 November 2007 21:04:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:06:17 UTC