title: Check if any ancestor has a class using jQuery
body: <p>Is there any way in jQuery to check if <em>any</em> parent, grand-parent, great-grand-parent has a class.</p>
  
  <p>I have a markup structure that has left me doing this sort of thing in the code:</p>
  
  <pre><code>$(elem).parent().parent().parent().parent().hasClass('left')
  </code></pre>
  
  <p>However, for code readability i'd like to avoid this sort of thing. Is there any way to say "any parent/grandparent/great-grand-parent has this class"?</p>
  
  <p>I am using jQuery 1.7.2.</p>