]> source.dussan.org Git - jquery.git/commitdiff
Use explicit "new jQuery.Event" to avoid double-function-call overhead.
authorDave Methvin <dave.methvin@gmail.com>
Tue, 12 Apr 2011 21:46:15 +0000 (17:46 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Tue, 12 Apr 2011 21:46:15 +0000 (17:46 -0400)
src/event.js

index b8a2e37ec14b9d002c9039224bc2a0e36069002b..5e2baf0d258cce88eef5700c494449bafe1d12d2 100644 (file)
@@ -314,9 +314,9 @@ jQuery.event = {
                        // jQuery.Event object
                        event[ jQuery.expando ] ? event :
                        // Object literal
-                       jQuery.extend( jQuery.Event(type), event ) :
+                       jQuery.extend( new jQuery.Event(type), event ) :
                        // Just the event type (string)
-                       jQuery.Event(type);
+                       new jQuery.Event(type);
                event.namespace = namespaces.join(".");
                event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
                event.exclusive = exclusive;
@@ -989,7 +989,7 @@ jQuery.fn.extend({
 
        triggerHandler: function( type, data ) {
                if ( this[0] ) {
-                       var event = jQuery.Event( type );
+                       var event = new jQuery.Event( type );
                        event.preventDefault();
                        event.stopPropagation();
                        jQuery.event.trigger( event, data, this[0] );