title: JavaScript DOM childNodes.length also returning number of text nodes
body: <p>In JavaScript DOM, childNodes.length returns the number of both element and text nodes. Is there any way to count only the number of element-only child nodes?</p>
  
  <p>For example, <code>childNodes.length</code> of <code>div#posts</code> will return 6, when I expected 2:</p>
  
  <pre><code>&lt;div id="posts"&gt;
      &lt;!-- some comment --&gt;
      &lt;!-- another comment --&gt;
      &lt;div&gt;an element node&lt;/div&gt;
      &lt;!-- another comment --&gt;
      &lt;span&gt;an element node&lt;/span&gt;
      a text node
  &lt;/div&gt;
  </code></pre>