jQuery's :first and :last on the first children of an element
<p>I have some simple tables (multiple, all with class="parent") with multiple <code>&lt;tr&gt; </code>rows. The <code>&lt;td&gt;</code> cells within these rows have tables of their own. I'm trying to target the <code>&lt;tr&gt;</code> rows of the <em>first</em> (parent) tables, like so:</p>

<p>HTML:</p>

<pre><code>&lt;table class="parent"&gt; 
  &lt;tr&gt; &lt;-- match with :first 
    &lt;td&gt; 
      &lt;table&gt; 
        &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; 
      &lt;/table&gt; 
    &lt;/td&gt; 
  &lt;/tr&gt; 
  &lt;tr&gt; &lt;-- match with :last 
    &lt;td&gt; 
      &lt;table&gt; &lt;-- so ignore this child ..
        &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;-- .. and do NOT match this &lt;tr&gt; with :last 
      &lt;/table&gt; 
    &lt;/td&gt; 
  &lt;/tr&gt; 
&lt;/table&gt;</code></pre>

<p>jQuery:</p>

<pre><code>$('table.parent').each(function() { 
  $(this).find('tr:first').dostuff(); 
  $(this).find('tr:last').dostuff(); 
});</code></pre>

<p>The <code>:first &lt;tr&gt;</code> works fine, since that's always the <code>&lt;tr&gt;</code> of the parent. But when I try to select the <code>:last &lt;tr&gt;</code>, it'll match the last <code>&lt;tr&gt;</code> of the nested table, and not the last <code>&lt;tr&gt;</code> of the parent table. How can I tell jQuery to only look at the <code>&lt;tr&gt;</code>s that are in the parent table, and don't search any further in possible children tables?</p>
