Select elements in cached jQuery object
<p>Assume we were passed the following element:</p>

<pre><code>var cachedElement = $('&lt;div&gt;&lt;p&gt;Some text&lt;/p&gt;&lt;/div&gt;&lt;aside&gt;Some more text&lt;/aside&gt;');
</code></pre>

<p>If I know what is in the element, I can easily traverse it. For example, to find the div I can use:</p>

<pre><code>cachedElement.filter('div');
</code></pre>

<p>and to find a child element I can use:</p>

<pre><code>cachedElement.find('p');
</code></pre>

<p>What if I do not know the structure of the cached element. How can I search for an element, which can be parent, child or both. </p>

<p>I was wondering if there is a method that can do that for me. I do not want to wrap the element in divs and search with .find().</p>

<p>My best solution is the following inefficient (and ugly) selector:</p>

<pre><code>cachedElement.filter('selector_string').add(cachedElement.find('selector_string')).eq(0)
</code></pre>

<p>In my particular case i need only the first element.</p>

<p>Any ideas?
Thanks</p>
