Opened 10 years ago

Closed 7 years ago

#4531 closed bug (wontfix)

e.originalTarget not set for WebKit and Opera on start/stop handlers

Reported by: rstrahl Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.sortable Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by mikesherov)

The start and stop handlers appear to not pass e.originalTarget in WebKit and Opera browsers. In the example below IE and FireFox correctly see e.originalTarget as the dragged child element:

        $("#divBookListWrapper").sortable(
        {
            opacity: 0.7,
            revert: true,
            scroll: true,
            containment: "parent",
            start: function(e) {
                // have to remvoe click handler off item so drop doesn't click
                $(e.originalTarget).unbind("click");
                //$(".bookitem").unbind("click");
        },
            stop: function(e) {
                $(ctl).data("Sort", "1");
                $(ctl).html($(ctl).html().replace("Sort List", "Update Sort"));

                // reattach the item click handler
                $(e.originalTarget).click(itemClickHandler);
                //$(".bookitem").click(itemClickHandler);
            }
        });    

The layout for this setup is a <div id="divListWrapper"> with a set of <div class="bookitem"> children that are draggable.

In FireFox

$("#divBookListWrapper").sortable(
        {
            opacity: 0.7,
            revert: true,
            scroll: true,
            containment: "parent",
            start: function(e) {
                // have to remvoe click handler off item so drop doesn't click
                //$(e.originalTarget).unbind("click");
                $(".bookitem").unbind("click");
        },
            stop: function(e) {
                $(ctl).data("Sort", "1");
                $(ctl).html($(ctl).html().replace("Sort List", "Update Sort"));

                // reattach the item click handler
                //$(e.originalTarget).click(itemClickHandler);
                $(".bookitem").click(itemClickHandler);
            }
        });    
}}
The layout is an outer <div id="divBookListWrapper"> with a set of <div class="bookitem"> children that are sortable.

It would also be nice if sortable had some optional facility to keep it from passing mouse events to the dragged item. The above code is necessary to prevent the item's click event handler to fire on drop, which is not the expected behavior.

Change History (4)

comment:1 Changed 10 years ago by Jörn Zaefferer

Milestone: TBD1.8

comment:2 Changed 7 years ago by Scott González

Milestone: 1.9.02.0.0

comment:3 Changed 7 years ago by mikesherov

Description: modified (diff)

comment:4 Changed 7 years ago by mikesherov

Resolution: wontfix
Status: newclosed

Thanks for contributing! This was deliberately removed in https://github.com/jquery/jquery/commit/69994211b078b8711220eaef33cc1bd6a63c5772 and is a proprietary property that won't be paved over in jQuery. For that reason, I'm marking this as wontfix.

Note: See TracTickets for help on using tickets.