HTML4 + <script><![CDATA[ </ENDTAG> ]]></script>

The validator doesn't consider the following code as valid HTML4 (HTML 
four):

<script type="text/javascript">//<![CDATA[
    document.write("<aa><bb></bb></aa>");
//]]></script>

At the same time, this is considered valid HTML 4 (four) (but invalid 
HTML5 (five)):

<p><![CDATA[
<aa><bb></bb></aa>
]]></p>

Both code examples should be considered valid HTML4 (four) syntax.

There are 3 reasons why this bug is important to fix:

(1) That the validator wrongly stamps the first example as invalid 
creates the impression that it is very difficult to embed javascript in 
a way that is valid both inside XHTML and inside HTML4. 

(2) In addition, it is also useful within HTML4! Because: the HTML4 
specification (as well as the validator) requires that end tags inside 
the <script> element are escaped - in order to be valid SGML. The HTML4 
spec gives the following example as example of _one_ way that one can 
escape the code so that the code is valid SGML both before and after 
script execution: "<\/b>". *However*, the <![CDATA[ ... ]]> syntax for 
marking up a section where escaping is not necessary is documented in 
the HTML4 specification as well. And is safe - and much simpler - to 
the <![CDATA[ ... ]]> escape method than making sure that every "/" is 
escaped. 

(3) Of course, that user agents doesn't care, is another matter. But 
that issue is only relevant w.r.t. embedding JavaScript. For other 
scripts/languages that are embedded inside <script>, then the <![CDATA[ 
... ]]> syntax can be useful. And, in fact, such a language is in fact 
the background for filing this bug. Thus, solving this bug matters for 
the extensibility of HTML4 (four)!

A bug has been filed - where all the above is documented with links to 
the HTML4 spec etc:

	http://www.w3.org/Bugs/Public/show_bug.cgi?id=8852

I linked the bug to component "Parser" - I don't know if that was 
correct. Please help me to make it correct. 

And, of of course, when can the bug be expected to be fixed? ;-)
-- 
leif halvard silli

Received on Monday, 1 February 2010 06:19:57 UTC