title: How to get all parents until a certain parent is reached
body: <p>I need something in-between the functionality of <code>.closest()</code> and <code>.parents()</code>. I am applying some CSS to all parents of a certain element up to a certain parent. Right now I'm <code>while</code> looping up, but it seems like there is a better way to do this.</p>
  
  <pre><code>var goUp = $(".distant-child");
  while(!goUp.hasClass("ancestor-to-stop-at")){
      goUp.css("height","100%");
      goUp = goUp.parent();
  }
  </code></pre>
  
  <p>I'd rather do something like one of these:</p>
  
  <pre><code>$(".distant-child").closest(".ancestor-to-stop-at").css("height","100%"); //won't work because .closest() only returns the top ancestor
  $(".distant-child").parents(".ancestor-to-stop-at").css("height","100%"); //won't work because .parents() doesn't take this parameter and won't stop at the specified element.
  </code></pre>
  
  <p>How can I achieve this without a <code>while</code> loop?</p>