Commit 79c58b84 authored by John Resig's avatar John Resig

Added a fix for triggered events not being cancellable. (You couldn't return...

Added a fix for triggered events not being cancellable. (You couldn't return false to stop a .submit(), for example.)
parent dfa1a024
...@@ -82,15 +82,14 @@ jQuery.event = { ...@@ -82,15 +82,14 @@ jQuery.event = {
// Handle triggering a single element // Handle triggering a single element
} else if ( element["on" + type] ) { } else if ( element["on" + type] ) {
if ( element[ type ] && element[ type ].constructor == Function ) // Pass along a fake event
element[ type ](); data.unshift( this.fix({ type: type, target: element }) );
else {
// Pass along a fake event
data.unshift( this.fix({ type: type, target: element }) );
// Trigger the event // Trigger the event
element["on" + type].apply( element, data ); var val = element["on" + type].apply( element, data );
}
if ( val !== false && element[ type ] && element[ type ].constructor == Function )
element[ type ]();
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment