title: .style of child nodes in d3js
body: <p>I'm trying to make a simple graph with nodes and links. I have "g" elements containing a circle and its text, and links on their own. I have, for example, this bit on code called on a mouseover event:</p>
  
  <pre><code>//check if circle is connected to current "viewed" (mouseover-ed) 
  //circle via a link referenced by "that" and paint it green if so
  circles.filter(function() {
           return d3.select(this).attr("index") == d3.select(that).attr("src");
           }).attr("viewed",1).style("stroke", "green");
                       });
  </code></pre>
  
  <p>This was really a long shot as nodes is the 'g' element container and I wasn't sure what calling .style would do, but to my surprise it did change the color - but only for the text!</p>
  
  <p>Is there a way to make it change the stroke style of the circle as well?</p>
  
  <p>The declaration code:</p>
  
  <pre><code>var circles = svg.append("g")
      .attr("class","nodes")
      .selectAll("circle")
      .data(graph.nodes)
      .enter()
      .append("g")
      .attr("transform",function(d,i){d.x = getX(i);d.y=getY(i);return "translate(" + d.x + "," + d.y + ")";})
      .attr("name", function(d){return d.name;})
      .attr("viewed",  0)
      .attr("focused", 0)
      .attr("index", function(d, i) {return i;});
  
  
  circles.append("circle")
      .style("stroke", "gray")
      .style("fill", "white")
     .attr("r", node_radius_wo_pad)
      .on("mouseover", function(){...};
  
  
  circles.append("text")
          .attr("text-anchor","middle")
          .text(function(d){return d.name});
  </code></pre>