Fix more jquery event shorthand usages
authorEd Sanders <esanders@wikimedia.org>
Fri, 18 Jan 2019 16:39:25 +0000 (16:39 +0000)
committerEd Sanders <esanders@wikimedia.org>
Fri, 18 Jan 2019 16:39:25 +0000 (16:39 +0000)
Not yet caught by the linter.

Change-Id: I9601bff47c099c4901487e7faaf871f23e2e2d1c

resources/src/jquery/jquery.suggestions.js
resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterTagMultiselectWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.RclTargetPageWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.SavedLinksListItemWidget.js
resources/src/mediawiki.widgets.datetime/CalendarWidget.js
resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js

index f2251f5..01d2ba5 100644 (file)
                                        context.data.$textbox.val( result.data( 'text' ) );
                                        // .val() doesn't call any event handlers, so
                                        // let the world know what happened
-                                       context.data.$textbox.change();
+                                       context.data.$textbox.trigger( 'change' );
                                }
                                context.data.$textbox.trigger( 'change' );
                        }
                                                                }
                                                                // Always bring focus to the textbox, as that's probably where the user expects it
                                                                // if they were just typing.
-                                                               context.data.$textbox.focus();
+                                                               context.data.$textbox.trigger( 'focus' );
                                                        } )
                                        )
                                        .append(
                                                                }
                                                                // Always bring focus to the textbox, as that's probably where the user expects it
                                                                // if they were just typing.
-                                                               context.data.$textbox.focus();
+                                                               context.data.$textbox.trigger( 'focus' );
                                                        } )
                                                        .on( 'mousemove', function ( e ) {
                                                                context.data.selectedWithMouse = true;
index e359416..1e7a6e4 100644 (file)
@@ -3,7 +3,7 @@
  */
 ( function () {
        $( function () {
-               mw.util.$content.dblclick( function ( e ) {
+               mw.util.$content.on( 'dblclick', function ( e ) {
                        var $a;
                        // Recheck preference so extensions can do a hack to disable this code.
                        if ( parseInt( mw.user.options.get( 'editondblclick' ), 10 ) ) {
index d0cc117..6d45144 100644 (file)
                mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.doInputEscape.call( this );
 
                // Blur the input
-               this.input.$input.blur();
+               this.input.$input.trigger( 'blur' );
        };
 
        /**
index 426c47f..dc76085 100644 (file)
@@ -57,7 +57,7 @@
         * Respond to the user choosing a title
         */
        mw.rcfilters.ui.RclTargetPageWidget.prototype.onLookupMenuItemChoose = function () {
-               this.titleSearch.$input.blur();
+               this.titleSearch.$input.trigger( 'blur' );
        };
 
        /**
index 3882a95..f1364d1 100644 (file)
                        this.saveButton.toggle( isEdit );
 
                        if ( isEdit ) {
-                               this.editInput.$input.focus();
+                               this.editInput.$input.trigger( 'focus' );
                        }
                        this.editing = isEdit;
                }
index 3ad6e29..b545164 100644 (file)
        mw.widgets.datetime.CalendarWidget.prototype.onPrevClick = function () {
                this.setFocusedDate( this.adjustDate( this.getFocusedDate(), 'month', -1 ) );
                if ( !this.$widget || OO.ui.contains( this.$element[ 0 ], document.activeElement, true ) ) {
-                       this.$element.focus();
+                       this.$element.trigger( 'focus' );
                }
        };
 
        mw.widgets.datetime.CalendarWidget.prototype.onNextClick = function () {
                this.setFocusedDate( this.adjustDate( this.getFocusedDate(), 'month', 1 ) );
                if ( !this.$widget || OO.ui.contains( this.$element[ 0 ], document.activeElement, true ) ) {
-                       this.$element.focus();
+                       this.$element.trigger( 'focus' );
                }
        };
 
                this.setFocusedDate( $button.getData() );
                this.setSelected( [ $button.getData() ] );
                if ( !this.$widget || OO.ui.contains( this.$element[ 0 ], document.activeElement, true ) ) {
-                       this.$element.focus();
+                       this.$element.trigger( 'focus' );
                }
        };
 
index f4ad578..fee27c5 100644 (file)
         */
        mw.widgets.datetime.DateTimeInputWidget.prototype.focus = function () {
                if ( !this.getFocusedField().length ) {
-                       this.$fields.find( '.mw-widgets-datetime-dateTimeInputWidget-editField' ).first().focus();
+                       this.$fields.find( '.mw-widgets-datetime-dateTimeInputWidget-editField' ).first().trigger( 'focus' );
                }
                return this;
        };
index 4d58f18..3a71760 100644 (file)
                                                // Tabbing backward from text input: normal browser behavior
                                        } else {
                                                // Tabbing forward from text input: just focus the calendar
-                                               this.calendar.$element.focus();
+                                               this.calendar.$element.trigger( 'focus' );
                                                return false;
                                        }
                                }
                                if ( e.which === OO.ui.Keys.TAB ) {
                                        if ( e.shiftKey ) {
                                                // Tabbing backward from calendar: just focus the text input
-                                               this.textInput.$input.focus();
+                                               this.textInput.$input.trigger( 'focus' );
                                                return false;
                                        } else {
                                                // Tabbing forward from calendar: focus the text input, then allow normal browser
                                                // behavior to move focus to next focusable after it
-                                               this.textInput.$input.focus();
+                                               this.textInput.$input.trigger( 'focus' );
                                        }
                                }
                        }.bind( this ) );
                if ( userSelected ) {
                        // Prevent focusing the handle from reopening the calendar
                        this.closing = true;
-                       this.$handle.focus();
+                       this.$handle.trigger( 'focus' );
                        this.closing = false;
                }
 
                this.textInput.toggle( true );
                this.calendar.toggle( true );
 
-               this.textInput.$input.focus();
+               this.textInput.$input.trigger( 'focus' );
        };
 
        /**
index f1c0c6f..55d8cf5 100644 (file)
                mw.widgets.SearchInputWidget.parent.prototype.onLookupMenuItemChoose.apply( this, arguments );
 
                if ( this.performSearchOnClick ) {
-                       this.$element.closest( 'form' ).submit();
+                       this.$element.closest( 'form' ).trigger( 'submit' );
                }
        };