Fixed [1993] although it actually wasn't a bug in the core but rather a misunderstanding of how the extra function was supposed to work in jQuery.event.trigger(). That said, it seems more useful and robust for the code to work the way the ticket author thought it should work so this change was made.

Now, if anything is returned from the extra function it will overwrite the return value of the event handlers.  This should only effect custom events unless someone had an extra function that returned a value other than false which would have been ignored before.
This commit is contained in:
David Serduke 2007-12-03 21:41:10 +00:00
parent a73445bbc7
commit 66fbbec3bb
2 changed files with 53 additions and 21 deletions

View file

@ -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") ) {