Path.bringToFront() removes event listeners in Edge #5238

Open
northlandiguana opened this Issue Jan 9, 2017 · 0 comments

Projects

None yet

1 participant

@northlandiguana
northlandiguana commented Jan 9, 2017 edited
  • [x ] I'm reporting a bug, not asking for help
  • [ x] I've looked at the documentation to make sure the behaviour is documented and expected
  • [x ] I'm sure this is a Leaflet code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • [x ] I've searched through the issues to make sure it's not yet reported
    (I commented in a merge thread, and @perliedman asked me to open an issue)

How to reproduce

  • Leaflet version I'm using: 1.2
  • Browser (with version) I'm using: Microsoft Edge 38.14393.0.0
  • OS/Platform (with version) I'm using: Windows 10
//Given a GeoJSON FeatureGroup of CircleMarker features:
function onEachFeature(feature, layer) {
    layer.on({
        mouseover: highlightFeature,
        mouseout: resetHighlight
    });
}

function highlightFeature(e) {
    var layer = e.target;

    //BUG: resetHighlight does not fire on mouseout after bringToFront() is called in Edge
    if (map.hasLayer(layer)){
        layer.bringToFront();
    };
}

What behaviour I'm expecting and which behaviour I'm seeing

When the path layer is moused over, it should call the highlightFeature() function, and on mouseout should call the resetHighlight() function. After layer.bringToFront() is called in Edge, these listeners appear to be removed; resetHighlight() does not fire on the path and highlightFeature() does not fire again. The issue does not occur if the layer is a raster marker instead of a path layer.

Minimal example reproducing the issue

  • [x ] this example is as simple as possible
  • [x ] this example does not rely on any third party code

Using http://playground-leaflet.rhcloud.com/ or any other jsfiddle like site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment