John Resig explains this pretty well: http://ejohn.org/apps/learn/#36 and http://ejohn.org/apps/learn/#38
In principle, Event is a function and an object (functions are objects). The first line of the event checks whether it is called as a function or as an instance of the Event object (with a new statement).
If you are looking for exactly how jQuery does this, look at line 3134-3138 of the jQuery source:
jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !this.preventDefault ) { return new jQuery.Event( src, props ); }
And this is due to jQuery forms .
Basically, on lines 3178-3194, the preventDefault event is added to the prototype Event. If an event is generated using new , it will be given this preventDefault method. Otherwise, it will not be determined.
source share