Added a fix for triggered events not being cancellable. (You couldn't return false to stop a .submit(), for example.)

This commit is contained in:
John Resig 2007-01-13 22:29:59 +00:00
parent dfa1a0246f
commit 79c58b8406

View file

@ -82,15 +82,14 @@ jQuery.event = {
// Handle triggering a single element
} else if ( element["on" + type] ) {
if ( element[ type ] && element[ type ].constructor == Function )
element[ type ]();
else {
// Pass along a fake event
data.unshift( this.fix({ type: type, target: element }) );
// Pass along a fake event
data.unshift( this.fix({ type: type, target: element }) );
// Trigger the event
element["on" + type].apply( element, data );
}
// Trigger the event
var val = element["on" + type].apply( element, data );
if ( val !== false && element[ type ] && element[ type ].constructor == Function )
element[ type ]();
}
},