title: D3.js: How to get the computed width and height for an arbitrary element?
body: <p>I need to know exactly the width and height for an arbitrary <code>g</code> element in my <code>SVG</code> because I need to draw a selection marker around it once the user has clicked it.</p>
  
  <p>What I've seen in the internet is something like: <code>d3.select("myG").style("width")</code>. The problem is that the element will not always have an explicit width attribute set. For instance, when I create a circle inside the <code>g</code>, it will have the radious (<code>r</code>) set instead of the width. Even if I use the <code>window.getComputedStyle</code> method on a <code>circle</code>, it will return "auto".</p>
  
  <p>Is there a way to calculate the width of an arbitrary <code>svg</code> selement in <code>D3</code>?</p>
  
  <p>Thank you.</p>