W3C home > Mailing lists > Public > www-validator@w3.org > April 2011

(unknown charset) Re: Faulty claims of certain errors

From: (unknown charset) Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Thu, 28 Apr 2011 21:24:21 +0200
To: (unknown charset) cj@mb-soft.com
Cc: (unknown charset) www-validator@w3.org
Message-ID: <20110428212421748350.14424349@xn--mlform-iua.no>
cj@mb-soft.com, Thu, 28 Apr 2011 11:48:43 -0500:

> An example is http://mb-soft.com/public/adversit.html

That page for instance has this code:

<SCRIPT type="text/javascript">
<!--
document.write("<font size=2>This page - - <b>" + document.title + 
"</b></font>");
[ snip ]
// -->
</SCRIPT>

If you replace '<!--' with '<!--</><ins><![CDATA[' and '-->' with 
']]></ins><script type="a/b">-->', then it will validate. 

Example:

<script type="text/javascript">
<!--</><ins><![CDATA[
document.write("<font size=2>This page - - <b>" + document.title + 
"</b></font>");
[ snip ]
// ]]></ins><script type="a/b">-->
</script>

Jukka explained the problem a few replies ago. [1] Simply put, the 
<script> element ends as soon as HTML4 sees a '</'. The odd, byt 
SGML-compatible, XHTML-compatible and HTML5-compateible code I show 
above lets you avoid using the more javascript based escape solutions 
to the problem that Jukka demonstrated.

[1] http://lists.w3.org/Archives/Public/www-validator/2011Apr/0037
-- 
leif halvard silli
Received on Thursday, 28 April 2011 19:24:52 GMT

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