According to the drag-and-drop processing model specified in the current (updated June 8, 2021) HTML specification, the drop()
event must fire before the dragend()
event.
The corresponding information is deeply nested in the document, but the section describing the end of the drag operation looks as follows (omissions and emphasis mine):
Otherwise, if the user ended the drag-and-drop operation (e.g. by
releasing the mouse button in a mouse-driven drag-and-drop interface),
or if thedrag
event was canceled, then this will be the last
iteration. Run the following steps, then stop the drag-and-drop
operation:
- […]
Otherwise, the drag operation might be a success; run these substeps:
- Let dropped be true.
- If the current target element is a DOM element, fire a DND event named
drop
at it; otherwise, use platform-specific
conventions for indicating a drop.- […]
- Fire a DND event named
dragend
at the source node.- […]