Skip to main content

Search and Top Navigation

#7852 closed bug (fixed)

Opened November 09, 2011 12:13AM UTC

Closed November 10, 2011 12:59PM UTC

Last modified November 10, 2011 12:59PM UTC

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:
Blocked by: Blocking:
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>

Attachments (0)
Change History (5)

Changed November 09, 2011 12:14AM UTC by hunter1728 comment:1

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

Changed November 09, 2011 12:17AM UTC by hunter1728 comment:2

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

Changed November 09, 2011 01:12AM UTC by scottgonzalez comment:3

milestone: 1.91.8.17
priority: minorblocker
status: newopen

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

Changed November 10, 2011 12:59PM UTC by Scott González comment:4

resolution: → fixed
status: openclosed

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

Changeset: 1b165148a6654f64d572bd4c28ddb2cee5f6a332

Changed November 10, 2011 12:59PM UTC by Scott González comment:5

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

(cherry picked from commit 1b165148a6654f64d572bd4c28ddb2cee5f6a332)

Changeset: aa4e8ab3fb83f2550bac1e5476bd20f84a5883d9