You might try implementing the following code into your D3.js JavaScript instead of using CSS:

var feature = g.selectAll("path")
    .on("mouseover", function() {"fill", "green").css("stroke", "red");
    .on("mouseout", function() {"fill", "").css("stroke", "");

I have found that using the JavaScript to apply styles has been much more efficient and easier to maintain than trying to use CSS to do so, unless you are specifically using classes. In which case, I would use the .classed() method ( to manage the adding and removal of classes.

Hope this helps! If not, sorry. :-/


I edited to include the mouseout functionality. After looking into this more deeply, the Leaflet thing just pulls in new images, not redrawing an SVG, which is what D3.js does. My only guess is that Safari is ignoring the z-index of your path element. This is apparent whenever you right-click on the path area and then select Inspect Element from the dropdown. On Chrome, it will show you the HTML for the path element, but on Safari, it shows you the HTML for the image being pulled in by the Leaflet stuff.

Related Query

More Query from same tag