title: D3.js: Get an array of the data attached to a selection?
body: <p>I'd like to get an array of all the data attached to a selection in D3.</p>
  
  <p>I'm working with the example from the <a href="http://bl.ocks.org/mbostock/3808218">General Update pattern</a>, and trying this:</p>
  
  <pre><code>var text = svg.selectAll("text")
    .data(data, function(d) { return d; });
  
  var textEnter = text.enter().append("text")
    .attr("class", "enter")
    .text(function(d) { return d; });
  
  console.log('textEnter data', textEnter[0]);
  
  var textEnterKeys = d3.map(textEnter[0], function(d) { 
    return d.__data__;
  });
  
  console.log('textEnterKeys', textEnterKeys);
  </code></pre>
  
  <p>But <code>textEnterKeys</code> just looks exactly the same as <code>textEnter</code>. How can I get an array of the data attached to each element in the selection?</p>