]> source.dussan.org Git - jquery.git/commitdiff
It's now possible to trigger default events like .click(), .submit(), .focus(), etc...
authorJohn Resig <jeresig@gmail.com>
Tue, 2 Jan 2007 17:34:56 +0000 (17:34 +0000)
committerJohn Resig <jeresig@gmail.com>
Tue, 2 Jan 2007 17:34:56 +0000 (17:34 +0000)
src/event/event.js

index d2609ccbe36bf0341b68e68084f418f0528d1e8a..1a8a6b51968948ac6e59ce1bb65c0b12beb7eff4 100644 (file)
@@ -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 );
+                       }
                }
        },