Ticket #7852 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Droppable event target changes under jQuery 1.7

Reported by: hunter1728 Owned by:
Priority: blocker Milestone: 1.8.17
Component: ui.droppable Version: 1.8.16
Keywords: Cc:
Blocking: Blocked by:

Description

Under 1.6.4 the event target on a droppable drop was the element that the drop occurred to, whereas with 1.7 the event target becomes the element being dropped.

If you drop 'one' onto 'two', under 1.7 the console shows 'one' whereas under 1.6.2 it shows 'two'

 http://jsfiddle.net/pkzvb/

(can't seem to do jsfiddle with 1.6.4 as it doesn't seem to do jquery ui)

<!DOCTYPE HTML> <html> <head> <!-- <script src="  http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> -->

<script src="  http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js" type="text/javascript"></script> <script src="  http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script> <script> function OnDrop(e, ui) {

console.log(e.target.id);

}

$(document).ready(function () {

$("#one").draggable(); $("#two").droppable({ drop: OnDrop });

});

</script>

</head> <body> <div id="one">one</div> <div id="two">two</div> </body> </html>

Change History

comment:1 Changed 3 years ago by hunter1728

Whoops, some inconsistencies there. I tried 1.6.2 and 1.6.4 and it makes no difference.

comment:2 Changed 3 years ago by hunter1728

 http://jsbin.com/egaked for the other behaviour

comment:3 Changed 3 years ago by scott.gonzalez

  • Priority changed from minor to blocker
  • Status changed from new to open
  • Milestone changed from 1.9 to 1.8.17

We need to force the target in _trigger because .trigger() no longer does.

comment:4 Changed 3 years ago by Scott González

  • Status changed from open to closed
  • Resolution set to fixed

Widget: Set event.target in ._trigger(). Fixes #7852 - Droppable event target changes under jQuery 1.7.

Changeset: 1b165148a6654f64d572bd4c28ddb2cee5f6a332

comment:5 Changed 3 years ago by Scott González

Widget: Set event.target in ._trigger(). Fixes #7852 - Droppable event target changes under jQuery 1.7. (cherry picked from commit 1b165148a6654f64d572bd4c28ddb2cee5f6a332)

Changeset: aa4e8ab3fb83f2550bac1e5476bd20f84a5883d9

Note: See TracTickets for help on using tickets.