title: jquery append() method on empty XML element
body: <p>This could just be a syntax error, but I'm trying to create a Document object from scratch, starting with <code>document.implementation.createDocument()</code> and then using jquery's <code>append()</code> method to add the elements. But it's not appending:</p>
  
  <pre><code>var myDoc = document.implementation.createDocument("", 'stuff', null);
  
  $("stuff",myDoc).attr("test","tested");
  
  $("stuff",myDoc).append("&lt;test&gt;A&lt;/test&gt;");
  $("&lt;test&gt;B&lt;/test&gt;").appendTo("stuff",soapEnv);
  
  var s = new XMLSerializer();
  alert(s.serializeToString(soapEnv));
  </code></pre>
  
  <p>This should output:</p>
  
  <pre><code>&lt;stuff test="tested"&gt;
      &lt;test&gt;A&lt;/test&gt;
      &lt;test&gt;B&lt;/test&gt;
  &lt;/stuff&gt;
  </code></pre>
  
  <p>But instead it outputs:</p>
  
  <pre><code>&lt;stuff test="tested" /&gt;
  </code></pre>
  
  <p>So the selector seems to be working, just not the method. My only guess is the method doesn't account for the fact that elements are empty (<code>&lt;stuff /&gt;</code>) until they have children. But that's just a guess.</p>