I use this D3 snippet to move SVG `g` elements to top of the rest element as SVG render order depends on the [order of elements in DOM](http://dev.w3.org/SVG/modules/renderorder/SVGRenderOrder.html), and there is no z index:

```
d3.selection.prototype.moveToFront = function () {
  return this.each(function () {
    this.parentNode.appendChild(this);
  });
};

```

I run it like:

```
d3.select(el).moveToFront()

```

My issue is that if I add a D3 event listener, like `d3.select(el).on('mouseleave',function(){})`, then move the element to front of DOM tree using the code above, all event listeners are lost in Internet Explorer 11, still working fine in other browsers.
How can I workaround it?