In HTML5 Spec, it seems the nested script tags are supported, so what does a real example look like?


In HTML5 Specification, I read this "If the script nesting level is not zero: ...Otherwise, ...". It seems the nested script tags are supported.

But what is a real example that uses the nested script tags? like the below one?

<script>  
document.write("<script> alert('I\'m in your head!')</script>");  
</script> 

When used to include dynamic scripts, the scripts may either be embedded inline or may be imported from an external file using the src attribute

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


Nested script tags are not meaningful because the contents of a script tag must be 'text':

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

The example given is entirely legal because the 'nested' script tag is simply a text string which will be interpreted when the script itself is executed.

Modifying the document and replacing it's content like this should just replace it's current contents, though I haven't tried.

I don't see any controversy here.