title: Jquery .insertBefore ignores closing tag and auto closes missing tags
body: <p>I try to split a div called "foo" into two div's by closing the first and then opening a new one with the same class, using .insertBefore. But jquery will ignore the div closing tag and auto complete the div with the missing closing tag.</p>
  
  <pre><code>$( '&lt;/div&gt;&lt;div class="foo"&gt;' ).insertBefore( 'h2:first' );
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>&lt;div class="foo"&gt;&lt;/div&gt;
  &lt;h2&gt;Title&lt;/h2&gt;
  </code></pre>
  
  <p>But want to accomplish this:</p>
  
  <pre><code>&lt;/div&gt;&lt;div class="foo"&gt;
  &lt;h2&gt;Title&lt;/h2&gt;
  </code></pre>
  
  <p>I am trying to split one div called "foo" into two div's, by closing the existing one, and then adding a new opening tag it will result in two div's "foo".</p>
  
  <p>Any solutions to this?</p>
  
  <p>Full html structure: ( i want to split this a couple of times in smaller blocks of "foo". All contents from "foo" come from the database and I cannot manipulate it otherwise than using jquery/js.</p>
  
  <pre><code>&lt;div class="foo"&gt;
      &lt;span&gt;Text here&lt;/span&gt;
      &lt;h2&gt;Title&lt;/h2&gt;
      &lt;p&gt;Text&lt;/p&gt;
      &lt;h2&gt;Title&lt;/h2&gt;
      &lt;p&gt;Text&lt;/p&gt;
      &lt;h2&gt;Title&lt;/h2&gt;
      &lt;p&gt;Text&lt;/p&gt;
      &lt;h3&gt;Another title&lt;/h3&gt;
      &lt;h2&gt;Title&lt;/h2&gt;
      &lt;p&gt;Text&lt;/p&gt;
      &lt;h2&gt;Title&lt;/h2&gt;
      &lt;p&gt;Text&lt;/p&gt;
      &lt;h3&gt;Another title&lt;/h3&gt;
      &lt;h2&gt;Title&lt;/h2&gt;
      &lt;p&gt;Text&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>