diff options
author | John Resig <jeresig@gmail.com> | 2007-01-02 17:34:56 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-01-02 17:34:56 +0000 |
commit | 4805a45c0669b298c24005ce6505b49d88f85fe7 (patch) | |
tree | d36651c4decf9a8e96d88df5bdffa8aabc434817 /src/event | |
parent | 0ae7198b9e1614be54eecb5bb0272094996397d9 (diff) | |
download | jquery-4805a45c0669b298c24005ce6505b49d88f85fe7.tar.gz jquery-4805a45c0669b298c24005ce6505b49d88f85fe7.zip |
It's now possible to trigger default events like .click(), .submit(), .focus(), etc. Using the jQuery event trigger.
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/event.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/event/event.js b/src/event/event.js index d2609ccbe..1a8a6b519 100644 --- a/src/event/event.js +++ b/src/event/event.js @@ -82,11 +82,15 @@ jQuery.event = { // Handle triggering a single element } else if ( element["on" + type] ) { - // Pass along a fake event - data.unshift( this.fix({ type: type, target: element }) ); - - // Trigger the event - element["on" + type].apply( element, data ); + if ( element[ type ] && element[ type ].constructor == Function ) + element[ type ](); + else { + // Pass along a fake event + data.unshift( this.fix({ type: type, target: element }) ); + + // Trigger the event + element["on" + type].apply( element, data ); + } } }, |