Chrome doesn\'t select with D3.js. In the following code all selections are empty.
This is a bug in webkit -- see the bug report. The short answer is that for it's just broken. You may be able to work around this by keeping explicit references to the gradients you need to modify, e.g.
var grad1 = defs.append("linearGradient");