I am trying to select `<tr>` elements from tables which contain subtables so as to retrieve `<tr>` elements from the tables only and not the subtables, hence why I cannot use the `find()` method. The other challenge is that the tables may or may not have a `<tbody>` hence why I cannot use `children()`. 

**The HTML code**

```
<table id='table1' class='toptable'>
    <tbody>
        <tr><td>
            <table class='subtable'>
                <tr></tr>   
            </table>
            </td></tr>
    </tbody>
</table>
<table id='table2' class='toptable'>
        <tr><td>
            <table class='subtable'>
                <tr></tr>   
            </table>
        </td></tr>
</table>

```

**The solution so far**

I found a way to select `<tr>` elements from the tables (whether they have a `tbody` or not) without selecting the `<tr>` elements from the subtables using the child selector `>`.

```
$('#table1 > tbody > tr).length // -> 1
$('#table2 > tbody > tr).length // -> 1

```

**Question**

How can I convert the above selectors to a single method that I would be able to apply to a table object, allowing me to itterate through the `table.toptable` collection and reuse that same method with both tables? (see below)

```
$('.toptable').each(function(){
   $(this).({trs-from-table}).each( ... );
});

```

**JSFIDDLE**

[Here is the link](http://jsfiddle.net/sdalskjdalskjdoij/TCJDp/)