title: d3 add multiple classes with function
body: <p>I have the svg as:</p>
  
  <pre><code>&lt;g class="user" title="Michael" rel="tooltip" transform = "rotate(-12.364052661705784)translate(360)" style="fill: #9467bd; "&gt;&lt;/g&gt;
  </code></pre>
  
  <p>I want to add a class as the same as title. I tried </p>
  
  <pre><code>d3.selectAll('.user').attr('class','Michael');
  </code></pre>
  
  <p>But it replaced the original class. Then I tried</p>
  
  <pre><code>d3.selectAll('.user').classed('Michael',true);
  </code></pre>
  
  <p>It works! But now I want to return the class name with a function like</p>
  
  <pre><code>d3.selectAll('.user').classed(function(){return this.attr('title');},true);
  </code></pre>
  
  <p>It doesn't work. How can I do that?</p>
  
  <p>Thanks</p>