title: Given a leaf node, find the common parent that contains that leaf node tags
body: <pre><code>&lt;div id='parent'&gt;
  
    &lt;div&gt;
       &lt;span&gt;
         &lt;a&gt;item1&lt;/a&gt;
       &lt;/span&gt;
    &lt;/div&gt;
  
    &lt;div&gt;
      &lt;span&gt;
        &lt;span&gt;
          &lt;a&gt;item2&lt;/a&gt;
        &lt;/span&gt;
      &lt;/span&gt;
    &lt;/div&gt;
  
    &lt;div&gt;
      &lt;span&gt;
        &lt;a&gt;item3&lt;/a&gt;
      &lt;/span&gt;
    &lt;/div&gt;
  
    &lt;div&gt;
      &lt;a&gt;item4&lt;/a&gt;
              &lt;/span&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>given <code>$('a').eq(1)</code> find the common parent that contains <code>a</code>. you can't start at $('#parent'), it has to start from the starting leaf node and traverse up and somehow discover all the other leaf node (anchors) like it.</p>
  
  <p>I have no control over the HTML, and need a way to automatically discover similar leaf nodes like the one I select.</p>