Skip to main content

Search and Top Navigation

#4531 closed bug (wontfix)

Opened May 13, 2009 06:22AM UTC

Closed October 29, 2012 05:49AM UTC

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

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.

Attachments (0)
Change History (4)

Changed May 13, 2009 08:24AM UTC by jzaefferer comment:1

milestone: TBD1.8

Changed October 11, 2012 02:54PM UTC by scottgonzalez comment:2

milestone: 1.9.02.0.0

Changed October 29, 2012 05:28AM UTC by mikesherov comment:3

description: 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. \ 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. \

Changed October 29, 2012 05:49AM UTC by mikesherov comment:4

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.