By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 949 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Is this legal?

P: n/a
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>

Jan 30 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a


G. wrote:
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>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 30 '06 #2

P: n/a

Martin Honnen wrote:
G. wrote:
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>


Also http://www.htmlhelp.com/tools/valida...ms.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.

Jan 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.