title: when looping through the DOM how do I check if I reached the body element?
body: <p>I'm looping through the DOM from a link element to the closest element with class <em>.ui-mobile-viewport</em>. This can either be a <strong>DIV</strong> or the <strong>BODY</strong> element. </p>
  
  <p>I need to check which element it is and am getting nowhere... this is what I'm trying:</p>
  
  <pre><code>var targetViewport;
  </code></pre>
  
  <p>// loop sets targetViewport as a $('div.ui-mobile-viewport') or $('body.ui-mobile-viewport')</p>
  
  <pre><code>if ( targetViewport === $('body') ) {
     console.log("found a body");
     }
  </code></pre>
  
  <p>Thanks for help! </p>