Fixed [1993] although it actually wasn't a bug in the core but rather a misunderstand...
[jquery.git] / src / event.js
index 4927249..7c718f4 100644 (file)
@@ -19,7 +19,7 @@ jQuery.event = {
                        
                // if data is passed, bind to handler 
                if( data != undefined ) { 
-               // Create temporary function pointer to original handler 
+                       // Create temporary function pointer to original handler 
                        var fn = handler; 
 
                        // Create unique handler function, wrapped around original handler 
@@ -171,8 +171,13 @@ jQuery.event = {
                                data.shift();
 
                        // Handle triggering of extra function
-                       if ( extra && extra.apply( element, data ) === false )
-                               val = false;
+                       if ( extra ) {
+                               // call the extra function and tack the current return value on the end for possible inspection
+                               var ret = extra.apply( element, data.concat( val ) );
+                               // if anything is returned, give it precedence and have it overwrite the previous value
+                               if (ret !== undefined)
+                                       val = ret;
+                       }
 
                        // Trigger the native events (except for clicks on links)
                        if ( fn && donative !== false && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) {
@@ -333,7 +338,7 @@ jQuery.fn.extend({
                        event.preventDefault();
                        
                        // and execute the function
-                       return args[this.lastToggle].apply( this, [event] ) || false;
+                       return args[this.lastToggle].apply( this, arguments ) || false;
                });
        },
 
@@ -348,7 +353,8 @@ jQuery.fn.extend({
                        while ( parent && parent != this ) try { parent = parent.parentNode; } catch(error) { parent = this; };
                        
                        // If we actually just moused on to a sub-element, ignore it
-                       if ( parent == this ) return false;
+                       if ( parent == this ) 
+                               return true;
                        
                        // Execute the right function
                        return (event.type == "mouseover" ? fnOver : fnOut).apply(this, [event]);
@@ -453,5 +459,5 @@ function bindReady(){
 // And prevent errors on refresh with events like mouseover
 // Window isn't included so as not to unbind existing unload events
 jQuery(window).bind("unload", function() {
-       $("*").add(document).unbind();
+       jQuery("*").add(document).unbind();
 });