I'm looking for the difference in performance between those two, I could not found in SSE no good answer about this topic.
Some examples would be of great help.
If you look at the jQuery code you can see that all click()
does is execute trigger('click')
:
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
Note this:
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
In other words, "If no arguments are passed to click
, execute trigger('click')
".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With