Skip to content

Commit

Permalink
Make sure the click suppressor is unbound on the same element it has …
Browse files Browse the repository at this point in the history
…been bound to at movestart.
  • Loading branch information
François Bruneau committed May 16, 2012
1 parent d2adb48 commit 9f21ed5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/jquery.event.move.js
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
// jquery.event.move // jquery.event.move
// //
// 1.0.1 // 1.0.2
// //
// Stephen Band // Stephen Band
// //
Expand Down Expand Up @@ -29,6 +29,8 @@


remove = jQuery.event.remove, remove = jQuery.event.remove,


movestartTarget = undefined,

// Just sugar, so we can have arguments in the same order as // Just sugar, so we can have arguments in the same order as
// add and remove. // add and remove.
trigger = function(node, type, data) { trigger = function(node, type, data) {
Expand Down Expand Up @@ -332,7 +334,8 @@
// Unbind the click suppressor, waiting until after mouseup // Unbind the click suppressor, waiting until after mouseup
// has been handled. // has been handled.
setTimeout(function(){ setTimeout(function(){
remove(e.target, 'click', returnFalse); remove(movestartTarget, 'click', returnFalse);
movestartTarget = undefined;
}, 0); }, 0);
}); });
} }
Expand Down Expand Up @@ -458,7 +461,8 @@


// Stop clicks from propagating during a move // Stop clicks from propagating during a move
// Why? I can't remember, but it is important... // Why? I can't remember, but it is important...
add(e.target, 'click', returnFalse); movestartTarget = e.target;
add(movestartTarget, 'click', returnFalse);


add(document, mouseevents.move, activeMousemove, data); add(document, mouseevents.move, activeMousemove, data);
add(document, mouseevents.end, activeMouseend, data); add(document, mouseevents.end, activeMouseend, data);
Expand Down Expand Up @@ -497,4 +501,4 @@
jQuery.event.props.push(props[l]); jQuery.event.props.push(props[l]);
} }
} }
})(jQuery); })(jQuery);

0 comments on commit 9f21ed5

Please sign in to comment.