When parsing a script node, the browser treats its contents as plain text, and immediately finishes parsing when it finds the first closing </script> character sequence.

As a consequence, nested script nodes are not possible, because all opening <script> tags found along the way are ignored.

Web browsers doesn't support nested <script>...</script> elements. But there is no error in such case and browers just close the first encountered <script> tag as soon as a closing </script> tag is found along the way. So there is a big chance to display something totally unexpected to the end-users.

Noncompliant Code Example

<script type="text/template">
  <div>
    Hello!
  </div>
  <script type="text/javascript">  <!-- Noncompliant -->
    alert("Hi!");
  </script>
</script>

Compliant Solution

<script type="text/javascript">
  alert("Hi!");
</script>

<script type="text/template">
  <div>
    Hello!
  </div>
</script>