Move the preventDefault() into the if-condition to trigger the
preventDefault() only together with the click() trigger.
Change-Id: Icde2187248b8b18cd4fd5085a92d840e1f77b00d
var $a;
// Recheck preference so extensions can do a hack to disable this code.
if ( parseInt( mw.user.options.get( 'editondblclick' ), 10 ) ) {
- e.preventDefault();
// Trigger native HTMLElement click instead of opening URL (T45052)
$a = $( '#ca-edit a' );
// Not every page has an edit link (T59713)
if ( $a.length ) {
+ e.preventDefault();
// eslint-disable-next-line no-jquery/no-event-shorthand
$a.get( 0 ).click();
}