title: jsdom: Appending scripts to body with jQuery
body: <p>How do you append a script to the DOM body using jsdom and jQuery? The obvious answer of using <code>$('body').append('&lt;script src="..."&gt;&lt;/script&gt;')</code> actually ends up adding the script in the document <code>head</code>.</p>
  
  <p>This is the basic node.js script I'm testing with:</p>
  
  <pre><code>var jsdom = require('jsdom');
  
  jsdom.env(
      "http://google.com",
      ['http://code.jquery.com/jquery-1.6.min.js'],
      function(err, window) {
          var $ = window.jQuery;
          $('body').append('&lt;script src="http://example.com/script.js"&gt;&lt;/script&gt;');
          console.log($('html').html());
      }
  );
  </code></pre>
  
  <p>which results in something beginning with:</p>
  
  <pre><code>&lt;head&gt;&lt;script src="http://example.com/script.js?_=1352426933034"&gt;&lt;/script&gt;...
  </code></pre>
  
  <p>Interestingly, if you add a space in <code>&lt;sc ript src="..."&gt;&lt;/script&gt;</code> this is appended correctly, so something (jsdom, I expect) is hijacking this script so it can add the cachebuster(?) and place it in the header. What's causing this and <strong>how do I prevent it from happening</strong> so it appends the script instead?</p>
  
  <p>For what its worth,</p>
  
  <pre><code>$ npm ls
  /Users/codyaray/dev/proxy/test
  └─┬ jsdom@0.2.19
    ├─┬ contextify@0.1.3
    │ └── bindings@1.0.0
    ├── cssom@0.2.5
    ├── cssstyle@0.2.3
    ├── htmlparser@1.7.6
    └─┬ request@2.11.4
      ├─┬ form-data@0.0.3
      │ ├── async@0.1.9
      │ └─┬ combined-stream@0.0.3
      │   └── delayed-stream@0.0.5
      └── mime@1.2.7
  </code></pre>