In d3, I make a lot of elements like this:
this.title = svg.append('text')
.attr('class', 'graph-title')
.text('blah blah blah');
I was hoping I could put that class in the CSS local to the component creating this svg, but you can't refer to the local css this way. What I did above would only work if I put the relevant style into the global CSS, which for reusability reasons is not what I'd like to do.
Is there some way I can programmatically add the local css class to this dynamically-created element?