title: JQuery .length returns 0. Doesn't return 0 in console
body: <p>I'm currently trying to count the amount of elements in a Google Charts legend including the pagination element. Here's a basic markup:</p>
  
  <pre><code>&lt;div id="piechart"&gt;
      &lt;svg&gt;
          &lt;defs&gt; &lt;/defs&gt;
          &lt;rect&gt; &lt;/rect&gt;
          &lt;g&gt;
              &lt;rect&gt; &lt;/rect&gt;
              &lt;g&gt; ... &lt;/g&gt;
              &lt;g&gt; ... &lt;/g&gt;
              &lt;g&gt; ... &lt;/g&gt;
              &lt;path&gt; &lt;/path&gt;
              &lt;g&gt; ... &lt;/g&gt;
              &lt;path&gt; &lt;/path&gt;
          &lt;/g&gt;
          &lt;g&gt; &lt;/g&gt;
          &lt;g&gt; &lt;/g&gt;
          &lt;g&gt; &lt;/g&gt;
      &lt;/svg&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And here is what I'm trying to do in a $(document).ready():</p>
  
  <pre><code>var svg = $("#piechart svg");
  var categoriescontainer = svg.find('g').first();
  var countcategories = categoriescontainer.children('g').length;
  alert(countcategories);
  </code></pre>
  
  <p>Countcategories always equals 0. However when I type in the same code in console after loading, I get 4. Am I doing something wrong?</p>