title: selecting root element in jquery
body: <p>I need to be able to select the root element from a <strong>fragment</strong> without knowing the node types, class, id or hierachy.</p>
  
  <pre><code>&lt;div id="0"&gt;
      &lt;div id="0a"&gt;
          &lt;div id="a01"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="0b"&gt;
      &lt;/div&gt;
      &lt;div id="0c"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to be able to do something like $(':root') and have 0 selected in the example above.</p>
  
  <p>Better still I would prefer <code>$(':level(0)')</code> which would mean the same as above, <code>$(':level(1)')</code> would select 0a, 0b and 0c and <code>$(':level(1)&gt;div')</code> would select a01.</p>
  
  <p>Any ideas on how to do it neatly?</p>