Browse files

Mouse: Changed mouseHandled check to a local var rather than using or…

…iginalEvent. Fixed #4333 - Nested draggables problem in IE
  • Loading branch information...
1 parent 70687f7 commit dafc941b3632bb79823a72c36bfae7f1f985ca25 @kborchers kborchers committed Aug 2, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 ui/jquery.ui.mouse.js
View
12 ui/jquery.ui.mouse.js
@@ -12,6 +12,11 @@
*/
(function( $, undefined ) {
+var mouseHandled = false;
+$( document ).mouseup( function( e ) {
@creage
creage added a note Sep 5, 2011

shouldn't this be mousedown?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ mouseHandled = false;
+});
+
$.widget("ui.mouse", {
version: "@VERSION",
options: {
@@ -45,9 +50,7 @@ $.widget("ui.mouse", {
_mouseDown: function(event) {
// don't let more than one widget handle mouseStart
- // TODO: figure out why we have to use originalEvent
- event.originalEvent = event.originalEvent || {};
- if (event.originalEvent.mouseHandled) { return; }
+ if( mouseHandled ) { return };
// we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event));
@@ -93,7 +96,8 @@ $.widget("ui.mouse", {
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
event.preventDefault();
- event.originalEvent.mouseHandled = true;
+
+ mouseHandled = true;
return true;
},

2 comments on commit dafc941

@creage

You've reverted the code back, but previously it was

$( document ).mousedown( function( e ) {
mouseHandled = false;
});

and you made it .mouseup - which causes an issue. I faced with problem dragging elements within two connected sortables - items wouldn't dragging until you click them.

@kborchers
jQuery Foundation member

If you have found a bug, please create a reduced, working test case on jsfiddle.net and then file the bug after checking to make sure it isn't already a known bug.

Please sign in to comment.