title: Find closest parent in relation to (not just contained within) a context
body: <p>With the following html</p>
  
  <pre><code>&lt;ul id="accordion"&gt;
      &lt;li&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;h3&gt;title&lt;/h3&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;h3&gt;title&lt;/h3&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;h3&gt;title&lt;/h3&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;       
  &lt;/ul&gt;
  </code></pre>
  
  <p>I have the outer ul stored in a variable</p>
  
  <pre><code>var acc = $("#accordion")[0]  
  </code></pre>
  
  <p><strong>in the general case I am just passed the DOM element and can't necessarily specify a selector</strong></p>
  
  <p>When a h3 is clicked I want to get the top level li that contains it. <strong>In the general case there could be any kind of markup between the accordion ul and the element I wnat to fetch, and between the element to fetch and the h3</strong>... but what I will have is a selector that lets me get to the element from the accordion using the ">" selector.</p>
  
  <p>e.g. var items = $(">li", acc); </p>
  
  <p>The trouble is that when I start from a clicked h3 ("this" inside the click handler) It's difficult to find the specific item.</p>
  
  <pre><code>$(this).closest("&gt;li", acc);
  </code></pre>
  
  <p>returns an empty jQuery (maybe a bug? although it's difficult to define what ">" means in this instance, where the top level element is dynamic)</p>
  
  <pre><code>$(this).parents("&gt;li")
  </code></pre>
  
  <p>doesn't allow a context to be set, so could potentially return too many elements</p>
  
  <p>Is there a way to do what I want?</p>
  
  <p>*edit: html now makes the problem clearer</p>