title: How to get the number of elements with a non-empty class name
body: <p>Sample code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log(document.querySelectorAll("p[class]").length);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p class=""&gt;Hello, world!&lt;/p&gt;
  &lt;p class="5"&gt;Hello, world!&lt;/p&gt;
  &lt;p class="9"&gt;Hello, world!&lt;/p&gt;
  &lt;p class=""&gt;Hello, world!&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What I get: <code>4</code><br>
  What I expect: <code>2</code></p>