r856 - in trunk: tests ui

r856 - in trunk: tests ui


Author: paul.bakaus
Date: Mon Nov 3 04:44:50 2008
New Revision: 856
Modified:
trunk/tests/draggable.js
trunk/ui/ui.core.js
Log:
mouse: events and default actions on click are not fired after a drag
action has been initiated
Modified: trunk/tests/draggable.js
==============================================================================
--- trunk/tests/draggable.js    (original)
+++ trunk/tests/draggable.js    Mon Nov 3 04:44:50 2008
@@ -628,6 +628,12 @@
});
+module("draggable: behaviour");
+
+test("Events should not be executed on the element if drag is initiated",
function() {
+    //TODO: Implement missing test
+});
+
module("draggable: Tickets");
Modified: trunk/ui/ui.core.js
==============================================================================
--- trunk/ui/ui.core.js    (original)
+++ trunk/ui/ui.core.js    Mon Nov 3 04:44:50 2008
@@ -345,9 +345,16 @@
    _mouseInit: function() {
        var self = this;
    
-        this.element.bind('mousedown.'+this.widgetName, function(e) {
-            return self._mouseDown(e);
-        });
+        this.element
+            .bind('mousedown.'+this.widgetName, function(e) {
+                return self._mouseDown(e);
+            })
+            .bind('click.'+this.widgetName, function(e) {
+                if(self._preventClickEvent) {
+                    self._preventClickEvent = false;
+                    return false;
+                }
+            });
        
        // Prevent text selection in IE
        if ($.browser.msie) {
@@ -437,6 +444,7 @@
        
        if (this._mouseStarted) {
            this._mouseStarted = false;
+            this._preventClickEvent = true;
            this._mouseStop(e);
        }