mediawiki.action.view.dblClickEdit: Move preventDefault()
authorFomafix <fomafix@googlemail.com>
Tue, 28 May 2019 18:10:48 +0000 (20:10 +0200)
committerFomafix <fomafix@googlemail.com>
Tue, 28 May 2019 18:14:16 +0000 (20:14 +0200)
Move the preventDefault() into the if-condition to trigger the
preventDefault() only together with the click() trigger.

Change-Id: Icde2187248b8b18cd4fd5085a92d840e1f77b00d

resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js

index dbf029e..7b7c70d 100644 (file)
@@ -7,11 +7,11 @@
                        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();
                                }