title: jQuery element.closest(...).attr is not a function when using each
body: <p>When iterating over some DOM elements I found it impossible to use .data or .attr on them:</p>
  
  <pre><code>$('.running').each (index, element) =&gt;
      console.log element.closest('[data-id]')
  </code></pre>
  
  <p>gets me</p>
  
  <pre><code>&lt;section class="job-block" data-id="240"&gt;&lt;/section&gt;
  ...
  </code></pre>
  
  <p>but</p>
  
  <pre><code>$('.running').each (index, element) =&gt;
      console.log element.closest('[data-id]').data('id')
  </code></pre>
  
  <p>throws</p>
  
  <blockquote>
    <p>Uncaught TypeError: element.closest(...).data is not a function</p>
  </blockquote>