Last Comment Bug 112288 - window.ondragdrop JS event is not getting triggered.
: window.ondragdrop JS event is not getting triggered.
Status: NEW
: helpwanted
Product: Core
Classification: Components
Component: Event Handling (show other bugs)
: Trunk
: x86 All
-- normal with 10 votes (vote)
: mozilla1.2alpha
Assigned To: Nobody; OK to take it and work on it
: Andrew Overholt [:overholt]
Depends on:
  Show dependency treegraph
Reported: 2001-11-27 16:17 PST by Madhur Bhatia
Modified: 2010-12-31 04:50 PST (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

testcase (323 bytes, text/html)
2001-11-27 16:19 PST, Madhur Bhatia
no flags Details

Description User image Madhur Bhatia 2001-11-27 16:17:43 PST
platforms - all
OS - all

2001-10-22-0.9.4 branch build (NS6.2)
2001-11-26-6.2.1 rtm build (NS6.2.1)

Open the testcase and dragdrop any file or link onto this window. 

an alert box is supposed to be displayed with the message "ondragdrop event has 
been triggered"

the ondragdrop JS event is not getting triggered.

works fine on NS4.77
Comment 1 User image Madhur Bhatia 2001-11-27 16:19:33 PST
Created attachment 59428 [details]
Comment 2 User image Boris Zbarsky [:bz] (still a bit busy) 2001-11-27 18:36:23 PST
Is this really something we want untrusted web content to be able to detect?
Comment 3 User image Andrew Miller 2002-09-17 15:42:02 PDT
It doesn't seem that this event is implemented.  It's also possible that I'm not
using it correctly, but there isn't much documentation available (only found, which
doesn't say much).
Comment 4 User image Tobias Burnus 2003-06-16 05:06:34 PDT
Note that this works in NS4 and that this is useful for creating a web kiosk
(see bug 152080).
Comment 5 User image Pham 2003-08-01 21:51:39 PDT
Comment 6 User image Tom Metro 2004-10-11 00:06:58 PDT
This bug hasn't had any activity in about 2 years, but it still exists, at least
in the latest Firefox builds.

I'm not sure why there isn't more interest expressed by end-users at this
missing functionality.

I've started a thread on this in the "Mozilla Bugs" forum:

Below is the revelant portion of my posting:

Neither the onDragDrop element attribute, as used in this demo:

or the ondragdrop window property (window.ondragdrop), as discussed here:

seem to work. They don't produce an error, but the handler never gets called.

This seems to be a capability left out of Mozilla (and in turn Firefox), yet
there doesn't appear to be[...]discussion on the forums, which makes me wonder
if it was an intentional omission. One reason why it might be intentional is
that to fully handle drag-and-drop you potentially need to set many attributes
(enabling the acceptance of dropped items, specifying the types of items
accepted, etc.) and handlers, though you can get away with defaults in many
cases. I could see developers arguing that merely providing a simple handler
would be an incomplete solution, and thus leaving the feature out until someone
was ready to implement the full capability. But I haven't seen any discussion
like that.

I have found that the DOM specified technique:

document.addEventListener("dragdrop", handler, true);

works in Firefox (and I'd assume Mozilla), but still find it odd that the other
documented forms are not functioning. 

Comment 7 User image Boris Zbarsky [:bz] (still a bit busy) 2004-10-11 07:36:59 PDT
Those are documented for Netscape 4, not for Mozilla.
Comment 8 User image Tom Metro 2004-10-11 14:32:14 PDT
(In reply to comment #7)
> Those are documented for Netscape 4, not for Mozilla.
  An event handler for drag & drop events sent to the window.

Although at the bottom it says:
  DOM Level 0. Not part of specification.

and I haven't been able to figure out yet whether that means not part of the W3C
spec., but part of Mozilla's spec., or the opposite.

Probably the former, if this is the applicable W3C spec:

(I don't see a "Level 0" spec. (unless that's shorthand for saying it isn't in
the spec.), but DOM Level 2 is from the same time period as the Mozilla document)

The section specifically on ECMAScript Language Binding:

or the newer DOM Level 3 equivalents:

None mention window.ondragdrop.

I see the HTML 4.01 spec. also doesn't list an "ondragdrop" event handler attribute:

which probably explains why it isn't implemented in Mozilla.

Maybe the needed patch is for the Mozilla spec. instead of the code. Ideally
leaving a placeholder referring people to the newer document.addEventListener() API.

I'm still curious to know why this was dropped, but that will probably require
data mining in the W3C working group list archives...
Comment 9 User image Dean Fitzgerald 2005-04-27 10:20:52 PDT
Interestingly, other drag events _are_ being triggered, just not dragdrop. 
Dragenter, dragover, dragexit, are all being triggered.  Dragdrop isn't included
in that list.  Here's a snippet of logged events arising from dragging an image
from one frame into another:

Clarification: the destination frame into which I am dragging elements (imgs)
has an event handler that logs these events.

What is also interesting is that mouse events are not registered until I release
the held-mouse button that should terminate the drag.  I'd assume that this
would consist of a mouseup event, but no mouseup event is registered at that
time.  I must press the mouse button a second time before a mouseup event
actually is sent.

Tom Metro's previous comment seems to suggest that addEventListener
documentation provides an authoritative account of what the mozilla browser
supports and what it does not, yet the mozilla DOM documentation does describe
dragenter, dragover, dragexit, dragdrop events, and my above test case does
employ addEventListener to attach event handlers. If there is confusion
regarding what the mozilla browser does and does not support, then this
confusion has not yet been cleared up by mozilla documentation.
Comment 10 User image Christian Höltje 2008-01-29 08:15:34 PST
Any updates?
Comment 11 User image Christian Höltje 2008-01-29 10:58:52 PST
(In reply to comment #10)
> Any updates?

Pardon my faux pas of providing no material benefit to the bug.

This bug is still present in FF3.0

It seems like it would be a very useful feature, especially in light of AJAX tools that do things like edit images (flickr, etc.) or edit documents (google docs). 

Is there a decision being made behind the scenes or subconsciously  (even inaction is an action) that isn't documented here?

Comment 12 User image henryfhchan 2010-12-31 04:50:25 PST

Note You need to log in before you can comment on or make changes to this bug.