I found both of them works in my test:
.on("mouseover",
function() {
d3.select(this)
.select("text")
.style("fill","red");
})
or
.on("mouseover",
function() {
d3.select(this)
.select("text")
.attr("fill","red");
})
If you look at the HTML you get, you’ll see something like:
and
..which are both legal in SVG, but using attr when you need style could trip you up if you use it for something else.