Closed Bug 1469159 Opened 6 years ago Closed 6 years ago

Mozilla handle drop event strangely

Categories

(Core :: DOM: Events, defect)

60 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 218415

People

(Reporter: elisaturim16, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36

Steps to reproduce:

i simply tried that  http://jsfiddle.net/60mtjp18/6/ 
i added an eventlistener to a call to 'drop' but instead of adding element to other (in that example i simply log the id) i got redirected.
That happen on mozilla 60.0.2


Actual results:

https://stackoverflow.com/questions/50891008/why-does-mozilla-60-0-2-redirect-ppl-on-drop-event-even-with-preventdefault
maybe better to read but in short, i got redirected instead of dropping element


Expected results:

on chrome that behaviour is fixed, element drop correctly
I should add that without the eventlistener the event works fine
it's because `event` variable is not defined here.

>         currentDiv.addEventListener("drop", function () {
>             drop(event)
>         },false);

`window.event` has been non-standard extension.
now the spec is changed (bug 218415 comment #27, https://github.com/whatwg/dom/pull/407/files).

for now, you can workaround by explicitly using parameter instead of window's property.
(which is "strongly encouraged", by the spec)

>         currentDiv.addEventListener("drop", function (event) {
>             drop(event)
>         },false);
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Component: Untriaged → DOM: Events
Product: Firefox → Core
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.