title: Removing SVG element in D3 that is draggable results in Cannot read property 'ownerSVGElement' of null
body: <p>I am simply trying add and remove elements (nodes/circles) using d3 on a SVG element. However, my code keeps generating the following exception.</p>
  
  <pre>
  Uncaught TypeError: Cannot read property 'ownerSVGElement' of null
      at d3_mousePoint (VM2163 d3.js:1127)
      at d3.mouse (VM2163 d3.js:1122)
      at moved (VM2163 d3.js:1177)
      at VM2163 d3.js:1084
  d3_mousePoint @ VM2163 d3.js:1127
  d3.mouse @ VM2163 d3.js:1122
  moved @ VM2163 d3.js:1177
  (anonymous) @ VM2163 d3.js:1084
  </pre>
  
  <p>The problem seems to be with adding dragging behavior to the elements because if I remove <code>.call(someDragFunction)</code> then adding and removing elements doesn't generate that exception (but then, of course, I can't drag those elements around the SVG canvas).</p>
  
  <p>An example is shown here <a href="http://plnkr.co/edit/DnSBXSjXhQ2AJsGYvWxE" rel="nofollow noreferrer">http://plnkr.co/edit/DnSBXSjXhQ2AJsGYvWxE</a>?. If you click "+node" and click on the SVG box, a node will be drawn. If you click "-node" and click on a node/circle drawn, that node will be removed. Only when the last node is attempted to be removed does the exception show. </p>
  
  <p>Any ideas on what I'm doing wrong? Btw, I'm using D3 v3.5.3.</p>