- From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
- Date: Thu, 28 Apr 2011 21:24:21 +0200
- To: cj@mb-soft.com
- Cc: www-validator@w3.org
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 UTC