Open Bug 112288 Opened 20 years ago Updated 2 years ago

window.ondragdrop JS event is not getting triggered.


(Core :: DOM: UI Events & Focus Handling, defect)

Not set





(Reporter: madhur, Unassigned)


(Keywords: helpwanted)


(1 file)

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
Attached file testcase
Is this really something we want untrusted web content to be able to detect?
Target Milestone: --- → mozilla1.2
QA Contact: madhur → rakeshmishra
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).
QA Contact: rakeshmishra → trix
Note that this works in NS4 and that this is useful for creating a web kiosk
(see bug 152080).
Assignee: joki → saari
QA Contact: trix → ian
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. 

Those are documented for Netscape 4, not for Mozilla.
(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...
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.
Assignee: saari → nobody
Keywords: helpwanted
Any updates?
(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?

QA Contact: ian → events
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.