Closed
Bug 458613
Opened 16 years ago
Closed 16 years ago
event.relatedTarget is not set for dragexit/dragleave events?
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: asaf, Assigned: enndeakin)
References
Details
Attachments
(2 files, 2 obsolete files)
916 bytes,
text/html
|
Details | |
11.25 KB,
patch
|
smaug
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
While testing and hacking tabbbrowser, I figured that event.realatedTarget is never set for the dragexit/dragleave events.
Assignee | ||
Comment 1•16 years ago
|
||
Asaf, does this work for you?
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
Reporter | ||
Comment 2•16 years ago
|
||
Nope, relatedTarget is still set to null.
Plus, and i don't know if that's related, effectAllowed for this event is unset.
Assignee | ||
Comment 3•16 years ago
|
||
Mano, do you have a testcase for relatedTarget?
Reporter | ||
Comment 4•16 years ago
|
||
I tested within the dragleave listener of tabbrowser. I don't have a standalone testcase, I could probably write one if that helps.
Note that tabbrowser won't rely on this api after my patch lands (I'm using coordinates checks instead for some other reasons). This used to work previously though, assuuming someone tested that code path.
Comment 5•16 years ago
|
||
Assignee | ||
Comment 6•16 years ago
|
||
Martijn, what is this test checking? relatedTarget should only apply to dragleave and dragenter, and be null for all other drag events.
Comment 7•16 years ago
|
||
Sorry, I didn't know that.
I was confused. I was thinking that dragend needed a relatedTarget to fix the bugs that bug 225680 caused.
But apparently that can be done with dragleave too, perhaps, if I understand this code correctly:
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/tabbrowser.xml#2277
Attachment #350073 -
Attachment is obsolete: true
Comment 8•16 years ago
|
||
The patch attached to this bug works fine for the testcase.
Assignee | ||
Comment 9•16 years ago
|
||
Comment on attachment 343418 [details] [diff] [review]
check for drag events for relatedTarget and button properties
OK, whether this fixes mano's issue or not, this is still a suitable patch for relatedTarget
Attachment #343418 -
Flags: review?(Olli.Pettay)
Comment 10•16 years ago
|
||
Based on HTML 5 .relatedTarget should be null by default for drag events.
Of course if relatedTarget is explicitly set using .initDragEvent, then
.relatedTarget shouldn't be null.
Btw, seems like we have some old version of initDragEvent(...), not the one
HTML 5 specifies.
Comment 11•16 years ago
|
||
So as such the patch is ok, but ESM shouldn't set relatedTarget for drag events.
Assignee | ||
Comment 12•16 years ago
|
||
It seems that the spec changed very recently -- before drag events were just UIEvents so didn't have a relatedTarget. The relatedTarget should be updated for the dragenter/dragleave events to mirror the mouse ones (likely this is an oversight in the spec).
Comment 13•16 years ago
|
||
Neil, could you bring up this issue in whatwg?
Comment 14•16 years ago
|
||
Comment on attachment 343418 [details] [diff] [review]
check for drag events for relatedTarget and button properties
Anyway, I'd like to see the right kind of .initDragEvent()
Attachment #343418 -
Flags: review?(Olli.Pettay) → review-
Assignee | ||
Comment 15•16 years ago
|
||
(In reply to comment #14)
> (From update of attachment 343418 [details] [diff] [review])
> Anyway, I'd like to see the right kind of .initDragEvent()
What does that have to do with this bug?
Comment 16•16 years ago
|
||
With initDragEvent scripts can set .relatedTarget to script generated
events.
Assignee | ||
Comment 17•16 years ago
|
||
Attachment #343418 -
Attachment is obsolete: true
Attachment #352216 -
Flags: review?(Olli.Pettay)
Updated•16 years ago
|
Attachment #352216 -
Flags: review?(Olli.Pettay) → review+
Comment 18•16 years ago
|
||
Comment on attachment 352216 [details] [diff] [review]
something like this
You could add some comment to those commented-out tests. (I know, not about this bug)
Looks good, r=me.
Please ask Hixie/WhatWG about .relatedTarget on system generated dnd events.
Comment 19•16 years ago
|
||
Comment on attachment 352216 [details] [diff] [review]
something like this
Is this actually missing a change to nsDOMClassInfo.cpp where DragEvents should be marked to be also MouseEvents?
Assignee | ||
Comment 20•16 years ago
|
||
(In reply to comment #19)
> (From update of attachment 352216 [details] [diff] [review])
> Is this actually missing a change to nsDOMClassInfo.cpp where DragEvents should
> be marked to be also MouseEvents?
You asked that once before I think ;) DragEvent inherits from MouseEvent.
Assignee | ||
Updated•16 years ago
|
Attachment #352216 -
Flags: superreview?(roc)
Attachment #352216 -
Flags: superreview?(roc) → superreview+
Assignee | ||
Updated•16 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•16 years ago
|
Flags: in-testsuite+
Comment 21•7 years ago
|
||
testcase not working anymore on "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0", the relatedTarget is always null (but Chrome 60 now returns a valid relatedTarget)
Comment 22•7 years ago
|
||
i can see this is not working (always null) in 57.0.4 (64-bit) on mac OS X.
Makes it impossible to see if the dragleave event is just for a nested child or the whole parent.
Assignee | ||
Comment 23•7 years ago
|
||
That issue is bug 1420590 which is to be fixed in Firefox 59.
Comment 24•7 years ago
|
||
ok awesome thanks!
i've been looking into enter/leave counting such as explained in https://stackoverflow.com/questions/10253663/how-to-detect-the-dragleave-event-in-firefox-when-dragging-outside-the-window as a potential workaround in the meantime
You need to log in
before you can comment on or make changes to this bug.
Description
•