It's now possible to trigger default events like .click(), .submit(), .focus(), etc. Using the jQuery event trigger.

This commit is contained in:
John Resig 2007-01-02 17:34:56 +00:00
parent 0ae7198b9e
commit 4805a45c06

View file

@ -82,12 +82,16 @@ 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 )
element[ type ]();
else {
// Pass along a fake event // Pass along a fake event
data.unshift( this.fix({ type: type, target: element }) ); data.unshift( this.fix({ type: type, target: element }) );
// Trigger the event // Trigger the event
element["on" + type].apply( element, data ); element["on" + type].apply( element, data );
} }
}
}, },
handle: function(event) { handle: function(event) {