jQuery.clone() causes browser to hang
<p>Why does the following jQuery code cause my browser to hang?</p>

<h3>Caution: do not run this unless you are prepared to force quit your browser</h3>

<pre><code>&lt;!DOCTYPE HTML&gt; 
  &lt;title&gt;Simple clone&lt;/title&gt; 
  &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; 

  &lt;div&gt;
    &lt;script&gt;$('div').clone().appendTo('body');&lt;/script&gt;
  &lt;/div&gt;
</code></pre>

<h3>Edit</h3>

<p>For those in the "infinite loop" camp, that should not be an issue. A perfectly safe (non-jQuery) version is:</p>

<pre><code>  &lt;div&gt;div
    &lt;script&gt;
      var el = document.getElementsByTagName('div')[0];
      document.body.appendChild(el.cloneNode(true));
    &lt;/script&gt;
  &lt;/div&gt;
</code></pre>

<p>So the issue is specifically related to how jQuery does clones.</p>

<h3>Edit 2</h3>

<p>It seems that jQuery causes script elements in clones to be executed. That isn't standard behaviour and is something about how jQuery does clones that is quite unexpected.</p>
