Triggered event handlers are only executed once now.

This commit is contained in:
John Resig 2007-01-22 02:41:23 +00:00
parent b81ea5f9ba
commit 6c72f188cd

View file

@ -87,13 +87,21 @@ jQuery.event = {
// Trigger the event // Trigger the event
var val = element["on" + type].apply( element, data ); var val = element["on" + type].apply( element, data );
if ( val !== false && jQuery.isFunction( element[ type ] ) ) if ( val !== false && jQuery.isFunction( element[ type ] ) ) {
this.triggered = true;
element[ type ](); element[ type ]();
} }
}
}, },
handle: function(event) { handle: function(event) {
if ( typeof jQuery == "undefined" ) return false; if ( typeof jQuery == "undefined" ) return;
// Handle the second event of a trigger
if ( jQuery.event.triggered ) {
jQuery.event.triggered = false;
return;
}
// Empty object is for triggered events with no data // Empty object is for triggered events with no data
event = jQuery.event.fix( event || window.event || {} ); event = jQuery.event.fix( event || window.event || {} );