It is expected that there <script>will be a script inside , not HTML.
The browser sees:
<script type="html/template" id="sample">
and begins to interpret everything that subsequently appears as a script when it reaches the inside <script, which is considered just plain text.
The exception is </script>that the browser is looking to switch contexts from script to HTML, so when it sees 1st </script>in:
<script type="text/javascript" charset="utf-8">alert('x');</script>
, script HTML, script node :
<script type="text/javascript" charset="utf-8">alert('x');
, , , .