title: d3.js foreach loop on all the paths contained in a svg
body: <p>I have a svg generated by d3.js like this one:</p>
  
  <pre><code>&lt;svg height="1094" width="1254"&gt;
      &lt;g id="countries" stroke-width="1px" transform=""&gt;
          &lt;path d="M100,519.150,200,250" fill="rgba(100,100,100,0.8)"
          stroke="rgba(200,200,200,0.5)" id="id1" class="1"&gt;&lt;/path&gt;
          &lt;path d="M100,519.150,200,250" fill="rgba(100,100,100,0.8)"
          stroke="rgba(200,200,200,0.5)" id="id2" class="1"&gt;&lt;/path&gt;
          &lt;path d="M100,519.150,200,250" fill="rgba(100,100,100,0.8)"
          stroke="rgba(200,200,200,0.5)" id="id3" class="3"&gt;&lt;/path&gt;
          &lt;path d="M100,519.150,200,250" fill="rgba(100,100,100,0.8)"
          stroke="rgba(200,200,200,0.5)" id="id4" class="1"&gt;&lt;/path&gt;
      &lt;/g&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>I want to do somtehing like that :</p>
  
  <pre><code>foreach(path in #countries){
      if(this.class === 3){dostuff}
  }
  </code></pre>
  
  <p>I've tried the jquery way :</p>
  
  <pre><code>$('#countries').find('path').each(function( index ) {
      console.log(this);
  });
  </code></pre>
  
  <p>... log nothing</p>
  
  <p>I've tried the d3.js way (countries was initialized as follow : <code>countries = svg.append('svg:g').attr('id', 'countries')</code> ):</p>
  
  <pre><code>countries.select('path').each(console.log(this));
  countries.selectAll('path').each(console.log(this));
  </code></pre>
  
  <p>log the window object (wtf?)</p>