I took a sample code from MDN and ran it in Chrome 57.0.2987.110 and Firefox 52.0.2.
Firefox Event Sequence
But Chrome never fired the dragexit
event.
Chrome Event Sequence
Further analysis of the dragexit
events, I found on Wikipedia that this is part of the Mozilla XUL events, which says:
In addition to common / W 3C events, Mozilla has defined a set of events that only work with XUL elements.
In case you need code snippets, here is dragexit
and dragleave
event snippet from plunkr .
document.addEventListener("dragexit", function(event) { console.log(event.type); // reset the transparency event.target.style.opacity = ""; }, false); document.addEventListener("dragleave", function(event) { console.log(event.type); // reset background of potential drop target when the draggable element leaves it if (event.target.className == "dropzone") { event.target.style.background = ""; } }, false);
There is an interesting tutorial that shows that the DnD API can be fully implemented without using the dragexit
event, which is not fully supported by all browsers. Your safe bet is to use the dragleave
event, which is well supported by all major browsers.
source share