See the definition of preventDefault
in jQuery 3.1.1:
jQuery.Event.prototype = {
// ...
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( e && !this.isSimulated ) {
e.preventDefault();
}
},
// ...
};
So basically it will just call native preventDefault
. If you are using jQuery I would use its method, it will also update isDefaultPrevented
which might be useful if you want to check it (but you could also use native .originalEvent.defaultPrevented
).
If you don't care about isDefaultPrevented
and know the event has not been simulated by jQuery, then calling native preventDefault
might be few milliseconds faster. That's the only potential advantage I can think of, but this definitely won't be a bottleneck.
Returning false
in a jQuery event listener is like using both preventDefault
and stopPropagation
.