title: Get elements by attribute when querySelectorAll is not available without using libraries?
body: <pre><code>&lt;p data-foo="bar"&gt;
  </code></pre>
  
  <p>How can you do the equivalent to</p>
  
  <pre><code>document.querySelectorAll('[data-foo]')
  </code></pre>
  
  <p>where <a href="https://developer.mozilla.org/en/DOM/Document.querySelectorAll">querySelectorAll</a> is <a href="http://caniuse.com/queryselector">not available</a>? </p>
  
  <p>I need a native solution that works at least in IE7. I don’t care about IE6.</p>