Extremely strange glitch in Chrome - parses contents of string!

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-04-23T06:15:31Z Indexed on 2010/04/23 6:23 UTC
Read the original article Hit count: 283

Filed under:
|
|
|

Okay - this is the dumbest glitch I have seen in a while:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type='text/javascript'>

var data = "</script>";

</script>
</head>
<body>

This should break!

</body>
</html>

This causes syntax errors because the JavaScript parser is actually reading the contents of the string. How stupid!

How can I put </script> in my code. Is there any way?

Is there a valid reason for this behavior?

© Stack Overflow or respective owner

Related posts about chrome

Related posts about html