HTML5 Spec seems to support nested script tags, so what does a real example look like?

In the HTML5 specification , I read this "If the nesting level of the script is not zero: ... Otherwise ...", the script tags seem to be supported.

But what is a real example that uses nested script tags? as shown below?

<script>  document.write("<script> alert('I\'m in your head!')</script>");  </script> 
+4
source share
2 answers

When using dynamic scripts, the scripts can either be inline inline or can be imported from an external file using src

http://www.quackit.com/html_5/tags/html_script_tag.cfm

0
source

Nested script tags do not make sense, since the contents of the script tag should be "text":

http://www.w3.org/html/wg/drafts/html/master/scripting-1.html#the-script-element

The above example is completely legal, since the tag 'inested' script is just a text string that will be interpreted when the script itself is executed.

Modify the document and replace it with content, as it should just replace its current content, although I have not tried it.

Here I do not see any disagreement.

0
source

Source: https://habr.com/ru/post/1435121/


All Articles