Made jQuery's internal trigger method return the value from handle. (Bug #1417)

This commit is contained in:
John Resig 2007-08-28 04:42:35 +00:00
parent 25e83d27cb
commit 15faf783b9

View File

@ -142,9 +142,12 @@ jQuery.event = {
// Trigger the event // Trigger the event
if ( jQuery.isFunction( element.$handle ) ) if ( jQuery.isFunction( element.$handle ) )
val = element.$handle.apply( element, data ); val = element.$handle.apply( element, data );
// Handle triggering native .onfoo handlers
if ( !fn && element["on"+type] && element["on"+type].apply( element, data ) === false ) if ( !fn && element["on"+type] && element["on"+type].apply( element, data ) === false )
val = false; val = false;
// Trigger the native events (except for clicks on links)
if ( fn && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) { if ( fn && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) {
this.triggered = true; this.triggered = true;
element[ type ](); element[ type ]();
@ -152,6 +155,8 @@ jQuery.event = {
this.triggered = false; this.triggered = false;
} }
return val;
}, },
handle: function(event) { handle: function(event) {