Is this legal?

G

G.

Earlier, I blamed Python for being unable to parse this, but just to be
sure, is this legal HTML (at least the part with " // </ht ml> " ?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Choke on this</title>
<script language="JavaScript">
<!--
// </ht ml> - this is a comment in JavaScript
-->
</script>
</head>
<body>
Hey there
</body>
</html>
 
M

Martin Honnen

G. said:
Earlier, I blamed Python for being unable to parse this, but just to be
sure, is this legal HTML (at least the part with " // </ht ml> " ?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Choke on this</title>
<script language="JavaScript">
<!--
// </ht ml> - this is a comment in JavaScript
-->
</script>

According to SGML/HTML rules the first </ closes the opening <script>
tag so that </ht will close the opening <script>:
<http://www.w3.org/TR/html4/types.html#type-cdata>
 
C

cwdjrxyz

Martin said:
According to SGML/HTML rules the first </ closes the opening <script>
tag so that </ht will close the opening <script>:
<http://www.w3.org/TR/html4/types.html#type-cdata>

Also http://www.htmlhelp.com/tools/validator/problems.html#script may
be of some interest. Not observing the SGML requirement described here
is responsible for many complaints that the W3C and other validator
services receive that claim the validator is making an error, which in
fact it is not. It is just that in this case many browsers will display
the page properly despite the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top