+ words = text.text().split(/\s+/).reverse()
+ line_height = text.node().getBBox().height
+ # can get the actual font height, but on chrome it seems like getBBox().height
+ #line_height = parseInt window.getComputedStyle(this).fontSize, 10
+ tspan.text line.join " "
+ if tspan.node().getComputedTextLength() >= width
+ tspan.text line.join " "
+ tspan = text.append "tspan"
+ .attr "dy", line_height + "px"
+ .attr "dx", -tspan.node().getComputedTextLength() + "px"
+d3.selection.prototype.wordwrap = wordwrap