This example demonstrates how to transition back to a default style value after setting an inline style. Inside transition.style, temporarily remove the style to retrieve its default value; then restore the style before starting the transition.
In a future version of D3 (see related issue), transition.style(name, null) will probably do this for you automatically, rather than its current behavior of immediately removing the specified style at the start of the transition.
https://d3js.org/d3.v3.min.js