I feel like this is the wrong place for this logic. I think we should avoid altering d3 except at [explicitly documented extension points](https://github.com/mbostock/d3/wiki/Selections#extension).