W3C home > Mailing lists > Public > www-validator@w3.org > June 2008

Re: XHTML script validation error

From: Sierk Bornemann <sierkb@gmx.de>
Date: Wed, 4 Jun 2008 17:19:51 +0200
To: Jukka K. Korpela <jkorpela@cs.tut.fi>
Message-Id: <774D7834-1F31-4EA3-9D60-0D2EFAE656E7@gmx.de>
Cc: "Andras" <lgandras@hotmail.com>, <www-validator@w3.org>


Am 04.06.2008 um 11:05 schrieb Jukka K. Korpela:

> Its value shall be an Internet media type (in
> this case, "text/javascript"),

FYI:
... or, better, "application/javascript" or "application/ecmascript",  
as RFC4329 recommends. :-)

Modern web browsers like Firefox, Safari/Konqueror and Opera and  
recent Apache 2 webservers are able to handle these per RFC4329  
defined and recommended media types for scripts.
Hopefully IE8 or IE9 will catch up as soon as possible.

> Note that using "&lt;" instead, though valid and correct in theory, is
> not a practical move, since in pre-XHTML HTML, rules and different,  
> and
> IE is not understand real XHTML. The practical solution is to move the
> script to an external file and refer to it via <script
> type="text/javascript" src="foo.js"></script>

Or you have to escape the contens of the inline script the right way  
(escaping script code inside a XHTML document is slightly a bit  
different from escaping the same script code inside a HTML document).

See http://www.w3.org/TR/xhtml1/#h-4.8 and http://hixie.ch/advocacy/xhtml
for details.

Sierk
-- 
Sierk Bornemann
email:            sierkb@gmx.de
WWW:              http://sierkbornemann.de/
Received on Wednesday, 4 June 2008 15:20:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:29 GMT