Why is "</ script>" in the script tag considered to be a closing tag, but "<h1> hlo </h1>" does not display anything?
I read a book and then read this line: "The HTML parser does not know about your JavaScript code, it treats it like any other text." Therefore, if we write:
<script type="text/javascript">
alert("first");
var string = "</script>";
</script>
we get an error because it "</script>"works as a closing tag for the HTML parser, and the second line </script>works like a tight script, and then the script tag gives: -
Uncaught SyntaxError: Unexpected token ILLEGAL
even if the first is alert()not completed? I do not know why? But my main question is that if it is "</script>"processed as a tag, then when we write something like this:
var str = "<h1> hello world </h1>";
" " ? , HTML HTML-, ? - ? : (
, , https://www.w3.org/TR/html4/types.html#type-cdata
STYLE SCRIPT CDATA , CDATA - . . "</" ( ) . .
SCRIPT CDATA , (javascript intrepreter js css (?))
"</" ( < / , ?)
: -
var string = "</script>";
"</" (var string = ") js intrepreter, , (" "), , " ), , , </word terminater, , : -
var string = "<\/script>";
html- javascript, escape- , html- </ 3 charaters, , "< \",
: -
var str = "< /script>";
( < /, , allowrd , )
var str = "<" + "/ script > ";
, : -
var str = "</scr" + "pt > " . ( , .)
: -
fooobar.com/questions/26124/...
CDATA SCRIPT close-tag.
, engilsh