title: Find data() key-value pairs for every element
body: <p>What is the best way to view all jQuery <code>data</code> key-value pairs across <em>every</em> element (in jQuery 2.x)?</p>
  
  <p>A selection-oriented approach ( e.g. <code>$('*').data()</code> ) obviously does not work, because the return value is tied to a single element.</p>
  
  <p>I know that I can iterate over every element, checking each for data:</p>
  
  <pre><code>var allData = [];
  $('html *').each(function() {
      if($.hasData(this)) {
          allData.push({ el: this, data: $(this).data() })
      }
  })
  </code></pre>
  
  <p><a href="http://jsfiddle.net/jwhitfieldseed/A5WaA/" rel="nofollow">JSFiddle</a></p>
  
  <p>This does produce the expected output, but iterating over each possible data key feels like a backwards approach to this problem.</p>
  
  <p>Is there some way to find all element data directly?</p>
  
  <p>N.B. I'm interested for debugging, not production code.</p>