Html 5 Drag Events: 'dragleave' Fired After 'dragenter'
I'm using html5 dragevents in a single page application. Currently, I'm listening to the dragleave and dragenter events to set the proper classes on the elements. But, when two v
Solution 1:
A little late to the party but, here is my use case. Imagine that B is entirely enclosed in A:
+---------------------------+
| A |
| +---------------+ |
+-----+ | | B | |
| | | | | |
| -|------|------|---> | |
+-----+ | | | |
| | | |
| +---------------+ |
+---------------------------+
You can leave A here by leaving it entirely, or by leaving it to go to B. The fact that B.dragenter is fired before A.dragleave allows you to be aware of the direction of the drag in the A.dragleave handler.
In fact I just realise that the same goes for your use-case: you can leave A to the void (left-up-down) or to go to B (right).
Note that the above is my interpretation of 'why' this is useful. The behaviour itself confirmed by this section of the spec:
https://www.w3.org/TR/html51/editing.html#drag-and-drop-processing-model
Post a Comment for "Html 5 Drag Events: 'dragleave' Fired After 'dragenter'"