From b3e490bba67117ceb86d6e18c15039d65701a832 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 8 Jan 2019 17:40:11 +0000 Subject: [PATCH] build: Update eslint-config-wikimedia to 0.10.0 Change-Id: I2930bcabeeb7b7b2eb36063e77b26e664a691b43 --- .eslintrc.json | 4 +- mw-config/config.js | 34 +++++-- package.json | 2 +- .../jquery.tablesorter/jquery.tablesorter.js | 2 +- .../src/jquery/jquery.checkboxShiftClick.js | 2 +- .../src/jquery/jquery.makeCollapsible.js | 1 + resources/src/jquery/jquery.suggestions.js | 33 ++++--- resources/src/jquery/jquery.textSelection.js | 2 +- .../mediawiki.action.edit.editWarning.js | 2 +- .../mediawiki.action/mediawiki.action.edit.js | 2 +- .../mediawiki.action.edit.preview.js | 8 +- .../mediawiki.action.history.js | 10 +- .../mediawiki.action.view.dblClickEdit.js | 1 + .../mediawiki.action.view.postEdit.js | 2 +- .../mediawiki.action.view.rightClickEdit.js | 1 + resources/src/mediawiki.api/upload.js | 2 +- resources/src/mediawiki.checkboxtoggle.js | 6 +- resources/src/mediawiki.debug/debug.js | 6 +- .../src/mediawiki.filewarning/filewarning.js | 2 +- resources/src/mediawiki.htmlform.checker.js | 5 + resources/src/mediawiki.htmlform/cloner.js | 8 +- .../src/mediawiki.htmlform/multiselect.js | 2 +- .../src/mediawiki.htmlform/selectandother.js | 2 +- .../mediawiki.jqueryMsg.js | 2 +- resources/src/mediawiki.legacy/protect.js | 8 +- .../mediawiki.notification/notification.js | 4 +- resources/src/mediawiki.page.gallery.js | 4 +- resources/src/mediawiki.page.ready.js | 2 +- resources/src/mediawiki.page.watch.ajax.js | 2 +- .../dm/mw.rcfilters.dm.FiltersViewModel.js | 2 +- .../dm/mw.rcfilters.dm.SavedQueriesModel.js | 4 +- .../mw.rcfilters.Controller.js | 10 +- .../mediawiki.rcfilters/mw.rcfilters.init.js | 4 +- ...w.rcfilters.ui.ChangesListWrapperWidget.js | 2 + ...rcfilters.ui.FilterTagMultiselectWidget.js | 3 +- .../mw.rcfilters.ui.SavedLinksListWidget.js | 4 +- .../apisandbox.js | 6 +- resources/src/mediawiki.special.import.js | 2 +- .../src/mediawiki.special.recentchanges.js | 2 +- ...i.special.search.commonsInterwikiWidget.js | 4 +- .../src/mediawiki.special.search/search.js | 8 +- resources/src/mediawiki.special.undelete.js | 2 +- .../unwatchedPages.js | 2 +- .../src/mediawiki.special.upload/upload.js | 12 +-- resources/src/mediawiki.special.userrights.js | 1 + .../mediawiki.special.watchlist/watchlist.js | 8 +- resources/src/mediawiki.toc/toc.js | 3 + .../DateTimeInputWidget.js | 4 +- .../MediaSearch/mw.widgets.APIResultsQueue.js | 2 +- .../mw.widgets.MediaResourceProvider.js | 2 +- .../mw.widgets.DateInputWidget.js | 1 - .../mw.widgets.SearchInputWidget.js | 2 +- tests/qunit/.eslintrc.json | 9 +- tests/qunit/data/testrunner.js | 2 +- .../resources/jquery/jquery.color.test.js | 1 + .../jquery/jquery.tablesorter.test.js | 96 +++++++++---------- .../mediawiki.special.recentchanges.test.js | 4 +- .../resources/mediawiki/mediawiki.toc.test.js | 4 +- 58 files changed, 212 insertions(+), 155 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 97f7c31248..0c0a7b5d79 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,6 +10,8 @@ "OO": false }, "rules": { - "max-len": 0 + "quote-props": [ "error", "as-needed" ], + "max-len": "off", + "jquery/no-global-selector": "off" } } diff --git a/mw-config/config.js b/mw-config/config.js index 74bdcf85b1..b0c5c4c83a 100644 --- a/mw-config/config.js +++ b/mw-config/config.js @@ -18,7 +18,9 @@ $( '.config-help-field-data' ).hide() .closest( '.config-help-field-container' ).find( '.config-help-field-hint' ) .show() - .click( function () { + .on( 'click', function () { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-slide $( this ).closest( '.config-help-field-container' ).find( '.config-help-field-data' ) .slideToggle( 'fast' ); } ); @@ -29,11 +31,14 @@ $( document.getElementById( $( this ).attr( 'rel' ) ) ).hide(); } ); $( document.getElementById( $( '.dbRadio:checked' ).attr( 'rel' ) ) ).show(); - $( '.dbRadio' ).click( function () { + $( '.dbRadio' ).on( 'click', function () { var $checked = $( '.dbRadio:checked' ), $wrapper = $( document.getElementById( $checked.attr( 'rel' ) ) ); if ( $wrapper.is( ':hidden' ) ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-animate-toggle $( '.dbWrapper' ).hide( 'slow' ); + // eslint-disable-next-line jquery/no-animate-toggle $wrapper.show( 'slow' ); } } ); @@ -44,29 +49,38 @@ } ); // Show/hide Creative Commons thingy - $( '.licenseRadio' ).click( function () { + $( '.licenseRadio' ).on( 'click', function () { var $wrapper = $( '#config-cc-wrapper' ); if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-animate-toggle $wrapper.show( 'slow' ); } else { + // eslint-disable-next-line jquery/no-animate-toggle $wrapper.hide( 'slow' ); } } ); // Show/hide random stuff (email, upload) - $( '.showHideRadio' ).click( function () { + $( '.showHideRadio' ).on( 'click', function () { var $wrapper = $( '#' + $( this ).attr( 'rel' ) ); if ( $( this ).is( ':checked' ) ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-animate-toggle $wrapper.show( 'slow' ); } else { + // eslint-disable-next-line jquery/no-animate-toggle $wrapper.hide( 'slow' ); } } ); - $( '.hideShowRadio' ).click( function () { + $( '.hideShowRadio' ).on( 'click', function () { var $wrapper = $( '#' + $( this ).attr( 'rel' ) ); if ( $( this ).is( ':checked' ) ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-animate-toggle $wrapper.hide( 'slow' ); } else { + // eslint-disable-next-line jquery/no-animate-toggle $wrapper.show( 'slow' ); } } ); @@ -78,12 +92,15 @@ } // Enable/disable "other" textboxes - $( '.enableForOther' ).click( function () { + $( '.enableForOther' ).on( 'click', function () { var $textbox = $( document.getElementById( $( this ).attr( 'rel' ) ) ); // FIXME: Ugh, this is ugly if ( $( this ).val() === 'other' ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-slide $textbox.prop( 'readonly', false ).closest( '.config-block' ).slideDown( 'fast' ); } else { + // eslint-disable-next-line jquery/no-slide $textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' ); } } ); @@ -95,11 +112,14 @@ $( '#config_wgSitename' ).on( 'keyup change', syncText ).each( syncText ); // Show/Hide memcached servers when needed - $( 'input[name$="config__MainCacheType"]' ).change( function () { + $( 'input[name$="config__MainCacheType"]' ).on( 'change', function () { var $memc = $( '#config-memcachewrapper' ); if ( $( 'input[name$="config__MainCacheType"]:checked' ).val() === 'memcached' ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-animate-toggle $memc.show( 'slow' ); } else { + // eslint-disable-next-line jquery/no-animate-toggle $memc.hide( 'slow' ); } } ); diff --git a/package.json b/package.json index e3379cab83..75ebfef05f 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "deepmerge": "1.3.2", - "eslint-config-wikimedia": "0.9.0", + "eslint-config-wikimedia": "0.10.0", "grunt": "1.0.3", "grunt-banana-checker": "0.6.0", "grunt-contrib-copy": "1.0.0", diff --git a/resources/src/jquery.tablesorter/jquery.tablesorter.js b/resources/src/jquery.tablesorter/jquery.tablesorter.js index 2b67568cdf..4882e9e3da 100644 --- a/resources/src/jquery.tablesorter/jquery.tablesorter.js +++ b/resources/src/jquery.tablesorter/jquery.tablesorter.js @@ -977,7 +977,7 @@ } // Cancel selection - } ).mousedown( function () { + } ).on( 'mousedown', function () { if ( config.cancelSelection ) { this.onselectstart = function () { return false; diff --git a/resources/src/jquery/jquery.checkboxShiftClick.js b/resources/src/jquery/jquery.checkboxShiftClick.js index 63cf28c5b8..435e23f55e 100644 --- a/resources/src/jquery/jquery.checkboxShiftClick.js +++ b/resources/src/jquery/jquery.checkboxShiftClick.js @@ -14,7 +14,7 @@ var prevCheckbox = null, $box = this; // When our boxes are clicked.. - $box.click( function ( e ) { + $box.on( 'click', function ( e ) { // And one has been clicked before... if ( prevCheckbox !== null && e.shiftKey ) { // Check or uncheck this one and all in-between checkboxes, diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index 09306f634c..f5f047503d 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -82,6 +82,7 @@ } } + // eslint-disable-next-line jquery/no-animate-toggle $containers.toggle( action === 'expand' ); hookCallback(); } diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 1016e72c92..f2251f540c 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -163,6 +163,7 @@ // Only fetch if the value in the textbox changed and is not empty, or if the results were hidden // if the textbox is empty then clear the result div, but leave other settings intouched if ( val.length === 0 ) { + // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); context.data.prevText = ''; } else if ( @@ -266,6 +267,7 @@ if ( context.data !== undefined ) { if ( context.data.$textbox.val().length === 0 ) { // Hide the div when no suggestion exist + // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); } else { // Rebuild the suggestions list @@ -352,7 +354,7 @@ .addClass( 'suggestions-result' ) .attr( 'rel', i ) .data( 'text', context.config.suggestions[ i ] ) - .mousemove( function () { + .on( 'mousemove', function () { context.data.selectedWithMouse = true; $.suggestions.highlight( context, @@ -528,6 +530,7 @@ break; // Escape case 27: + // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); $.suggestions.restore( context ); $.suggestions.cancel( context ); @@ -538,6 +541,7 @@ case 13: preventDefault = wasVisible; selected = context.data.$container.find( '.suggestions-result-current' ); + // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); if ( selected.length === 0 || context.data.selectedWithMouse ) { // If nothing is selected or if something was selected with the mouse @@ -652,10 +656,10 @@ // Can't use click() because the container div is hidden when the // textbox loses focus. Instead, listen for a mousedown followed // by a mouseup on the same div. - .mousedown( function ( e ) { + .on( 'mousedown', function ( e ) { context.data.mouseDownOn = $( e.target ).closest( '.suggestions-results .suggestions-result' ); } ) - .mouseup( function ( e ) { + .on( 'mouseup', function ( e ) { var $result = $( e.target ).closest( '.suggestions-results .suggestions-result' ), $other = context.data.mouseDownOn; @@ -672,8 +676,9 @@ // This will hide the link we're just clicking on, which causes problems // when done synchronously in at least Firefox 3.6 (T64858). setTimeout( function () { + // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); - }, 0 ); + } ); } // Always bring focus to the textbox, as that's probably where the user expects it // if they were just typing. @@ -685,10 +690,10 @@ // Can't use click() because the container div is hidden when the // textbox loses focus. Instead, listen for a mousedown followed // by a mouseup on the same div. - .mousedown( function ( e ) { + .on( 'mousedown', function ( e ) { context.data.mouseDownOn = $( e.target ).closest( '.suggestions-special' ); } ) - .mouseup( function ( e ) { + .on( 'mouseup', function ( e ) { var $special = $( e.target ).closest( '.suggestions-special' ), $other = context.data.mouseDownOn; @@ -704,14 +709,15 @@ // This will hide the link we're just clicking on, which causes problems // when done synchronously in at least Firefox 3.6 (T64858). setTimeout( function () { + // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); - }, 0 ); + } ); } // Always bring focus to the textbox, as that's probably where the user expects it // if they were just typing. context.data.$textbox.focus(); } ) - .mousemove( function ( e ) { + .on( 'mousemove', function ( e ) { context.data.selectedWithMouse = true; $.suggestions.highlight( context, $( e.target ).closest( '.suggestions-special' ), false @@ -723,16 +729,17 @@ $( this ) // Stop browser autocomplete from interfering .attr( 'autocomplete', 'off' ) - .keydown( function ( e ) { + .on( 'keydown', function ( e ) { // Store key pressed to handle later context.data.keypressed = e.which; context.data.keypressedCount = 0; } ) - .keypress( function ( e ) { + .on( 'keypress', function ( e ) { context.data.keypressedCount++; + // eslint-disable-next-line jquery/no-event-shorthand $.suggestions.keypress( e, context, context.data.keypressed ); } ) - .keyup( function ( e ) { + .on( 'keyup', function ( e ) { // The keypress event is fired when a key is pressed down and that key normally // produces a character value. We also want to handle some keys that don't // produce a character value so we also attach to the keydown/keyup events. @@ -750,15 +757,17 @@ e.which === context.data.keypressed && allowed.indexOf( e.which ) !== -1 ) { + // eslint-disable-next-line jquery/no-event-shorthand $.suggestions.keypress( e, context, context.data.keypressed ); } } ) - .blur( function () { + .on( 'blur', function () { // When losing focus because of a mousedown // on a suggestion, don't hide the suggestions if ( context.data.mouseDownOn.length > 0 ) { return; } + // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); $.suggestions.cancel( context ); } ); diff --git a/resources/src/jquery/jquery.textSelection.js b/resources/src/jquery/jquery.textSelection.js index 6b4ab979a1..82aa24f617 100644 --- a/resources/src/jquery/jquery.textSelection.js +++ b/resources/src/jquery/jquery.textSelection.js @@ -202,7 +202,7 @@ } isSample = false; - $( this ).focus(); + $( this ).trigger( 'focus' ); if ( options.selectionStart !== undefined ) { $( this ).textSelection( 'setSelection', { start: options.selectionStart, end: options.selectionEnd } ); } diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js index 4c4f5eb521..cbfaf62870 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js @@ -34,7 +34,7 @@ } ); // Add form submission handler - $( '#editform' ).submit( function () { + $( '#editform' ).on( 'submit', function () { allowCloseWindow.release(); } ); } ); diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.js b/resources/src/mediawiki.action/mediawiki.action.edit.js index 966b5bcb90..a26da1d649 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.js @@ -43,7 +43,7 @@ if ( scrollTop.value ) { editBox.scrollTop = scrollTop.value; } - $editForm.submit( function () { + $editForm.on( 'submit', function () { scrollTop.value = editBox.scrollTop; } ); } diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js index 363b494740..e907a985b1 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js @@ -73,6 +73,8 @@ // Can't use fadeTo because it calls show(), and we might want to keep some elements hidden // (e.g. empty #catlinks) + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-animate $copyElements.animate( { opacity: 0.4 }, 'fast' ); api = new mw.Api(); @@ -189,7 +191,7 @@ .append( $( '' ) .attr( { href: mw.util.getUrl( template.title ), - 'class': ( template.exists ? '' : 'new' ) + class: ( template.exists ? '' : 'new' ) } ) .text( template.title ) ); @@ -258,6 +260,8 @@ mw.hook( 'wikipage.editform' ).fire( $editform ); } ).always( function () { $spinner.hide(); + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-animate $copyElements.animate( { opacity: 1 }, 'fast' ); @@ -297,7 +301,7 @@ if ( !document.getElementById( 'p-lang' ) && document.getElementById( 'p-tb' ) && mw.config.get( 'skin' ) === 'vector' ) { $( '.portal:last' ).after( $( '
' ).attr( { - 'class': 'portal', + class: 'portal', id: 'p-lang', role: 'navigation', 'aria-labelledby': 'p-lang-label' diff --git a/resources/src/mediawiki.action/mediawiki.action.history.js b/resources/src/mediawiki.action/mediawiki.action.history.js index a0bba6feb7..e63810805b 100644 --- a/resources/src/mediawiki.action/mediawiki.action.history.js +++ b/resources/src/mediawiki.action/mediawiki.action.history.js @@ -51,7 +51,7 @@ $( function () { return true; } - $lis.find( 'input[name="diff"], input[name="oldid"]' ).click( updateDiffRadios ); + $lis.find( 'input[name="diff"], input[name="oldid"]' ).on( 'click', updateDiffRadios ); // Set initial state updateDiffRadios(); @@ -61,7 +61,7 @@ $( function () { // Ideally we'd use e.target instead of $historySubmitter, but e.target points // to the form element for submit actions, so. - $historyCompareForm.find( '.historysubmit' ).click( function () { + $historyCompareForm.find( '.historysubmit' ).on( 'click', function () { $historySubmitter = $( this ); } ); @@ -71,7 +71,7 @@ $( function () { // Without the cloning we'd be changing the real form, which is slower, could make // the page look broken for a second in slow browsers and might show the form broken // again when coming back from a "next" page. - $historyCompareForm.submit( function ( e ) { + $historyCompareForm.on( 'submit', function ( e ) { var $copyForm, $copyRadios, $copyAction; if ( $historySubmitter ) { @@ -92,14 +92,14 @@ $( function () { $copyForm.find( ':submit' ).remove(); } - // IE7 doesn't do submission from an off-DOM clone, so insert hidden into document first + // Firefox requires the form to be attached, so insert hidden into document first // Also remove potentially conflicting id attributes that we don't need anyway $copyForm .css( 'display', 'none' ) .find( '[id]' ).removeAttr( 'id' ) .end() .insertAfter( $historyCompareForm ) - .submit(); + .trigger( 'submit' ); e.preventDefault(); return false; // Because the submit is special, return false as well. diff --git a/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js index 4b0e49b8d4..e359416a6a 100644 --- a/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js +++ b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js @@ -12,6 +12,7 @@ $a = $( '#ca-edit a' ); // Not every page has an edit link (T59713) if ( $a.length ) { + // eslint-disable-next-line jquery/no-event-shorthand $a.get( 0 ).click(); } } diff --git a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js index 68b5214019..c5dcd36fe0 100644 --- a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js +++ b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js @@ -54,7 +54,7 @@ } $popup = $( '
' ).addClass( 'postedit mw-notification' ).append( $content ) - .click( function () { + .on( 'click', function () { clearTimeout( timeoutId ); fadeOutConfirmation(); } ); diff --git a/resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js index 59d1d4f3fe..e3f96b12e7 100644 --- a/resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js +++ b/resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js @@ -21,6 +21,7 @@ if ( e.target.nodeName.toLowerCase() !== 'a' ) { // Trigger native HTMLElement click instead of opening URL (T45052) e.preventDefault(); + // eslint-disable-next-line jquery/no-event-shorthand $edit.get( 0 ).click(); } } ); diff --git a/resources/src/mediawiki.api/upload.js b/resources/src/mediawiki.api/upload.js index 8d4b2bc803..e5d057456a 100644 --- a/resources/src/mediawiki.api/upload.js +++ b/resources/src/mediawiki.api/upload.js @@ -221,7 +221,7 @@ } } ); tokenPromise.done( function () { - $form.submit(); + $form.trigger( 'submit' ); } ); } ); diff --git a/resources/src/mediawiki.checkboxtoggle.js b/resources/src/mediawiki.checkboxtoggle.js index a89293dd70..f0fbdb6d88 100644 --- a/resources/src/mediawiki.checkboxtoggle.js +++ b/resources/src/mediawiki.checkboxtoggle.js @@ -21,13 +21,13 @@ $checkboxes.prop( 'checked', check ); } - $( '.mw-checkbox-all' ).click( function () { + $( '.mw-checkbox-all' ).on( 'click', function () { selectAll( true ); } ); - $( '.mw-checkbox-none' ).click( function () { + $( '.mw-checkbox-none' ).on( 'click', function () { selectAll( false ); } ); - $( '.mw-checkbox-invert' ).click( function () { + $( '.mw-checkbox-invert' ).on( 'click', function () { $checkboxes.prop( 'checked', function ( i, val ) { return !val; } ); diff --git a/resources/src/mediawiki.debug/debug.js b/resources/src/mediawiki.debug/debug.js index 32dbdc199e..189363f236 100644 --- a/resources/src/mediawiki.debug/debug.js +++ b/resources/src/mediawiki.debug/debug.js @@ -55,7 +55,7 @@ hovzer.$.append( this.$container ); hovzer.update(); - $( '.mw-debug-panelink' ).click( this.switchPane ); + $( '.mw-debug-panelink' ).on( 'click', this.switchPane ); }, /** @@ -90,6 +90,8 @@ // Hide the current pane if ( requestedPaneId === currentPaneId ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-slide $currentPane.slideUp( updateHov ); debug.$container.data( 'currentPane', null ); return; @@ -98,6 +100,8 @@ debug.$container.data( 'currentPane', requestedPaneId ); if ( currentPaneId === undefined || currentPaneId === null ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-slide $requestedPane.slideDown( updateHov ); } else { $currentPane.hide(); diff --git a/resources/src/mediawiki.filewarning/filewarning.js b/resources/src/mediawiki.filewarning/filewarning.js index 572d8305b2..81bf1dd0a7 100644 --- a/resources/src/mediawiki.filewarning/filewarning.js +++ b/resources/src/mediawiki.filewarning/filewarning.js @@ -62,6 +62,6 @@ // Override toggle handler because we don't need it for this popup // object at all. Sort of nasty, but it gets the job done. - dialog.getPopup().toggle = $.noop; + dialog.getPopup().toggle = function () {}; } }() ); diff --git a/resources/src/mediawiki.htmlform.checker.js b/resources/src/mediawiki.htmlform.checker.js index beecfea58e..661a1c4b47 100644 --- a/resources/src/mediawiki.htmlform.checker.js +++ b/resources/src/mediawiki.htmlform.checker.js @@ -118,6 +118,8 @@ $errorBox = this.$errorBox; if ( errors.length === 0 ) { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-slide $errorBox.slideUp( function () { $errorBox .removeAttr( 'class' ) @@ -160,6 +162,8 @@ .removeAttr( 'class' ) .detach(); } + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-slide $errorBox .attr( 'class', 'error' ) .empty() @@ -169,6 +173,7 @@ .slideDown(); }; if ( $oldErrorBox !== $errorBox && $oldErrorBox.hasClass( 'error' ) ) { + // eslint-disable-next-line jquery/no-slide $oldErrorBox.slideUp( showFunc ); } else { showFunc(); diff --git a/resources/src/mediawiki.htmlform/cloner.js b/resources/src/mediawiki.htmlform/cloner.js index 6e33856daf..8ead7a4a2c 100644 --- a/resources/src/mediawiki.htmlform/cloner.js +++ b/resources/src/mediawiki.htmlform/cloner.js @@ -43,8 +43,8 @@ deleteButton.$element.closest( 'li.mw-htmlform-cloner-li' ).remove(); } ); } else { - $element.filter( ':input' ).click( function ( ev ) { - ev.preventDefault(); + $element.filter( ':input' ).on( 'click', function ( e ) { + e.preventDefault(); $( this ).closest( 'li.mw-htmlform-cloner-li' ).remove(); } ); } @@ -56,8 +56,8 @@ appendToCloner( createButton.$element ); } ); } else { - $createElement.filter( ':input' ).click( function ( ev ) { - ev.preventDefault(); + $createElement.filter( ':input' ).on( 'click', function ( e ) { + e.preventDefault(); appendToCloner( $( this ) ); } ); diff --git a/resources/src/mediawiki.htmlform/multiselect.js b/resources/src/mediawiki.htmlform/multiselect.js index ab11f858e3..a778902de4 100644 --- a/resources/src/mediawiki.htmlform/multiselect.js +++ b/resources/src/mediawiki.htmlform/multiselect.js @@ -14,7 +14,7 @@ name: name, multiple: 'multiple', 'data-placeholder': dataPlaceholder.plain(), - 'class': 'htmlform-chzn-select mw-input ' + oldClass + class: 'htmlform-chzn-select mw-input ' + oldClass } ); $oldContainer.find( 'input' ).each( function () { var $oldInput = $( this ), diff --git a/resources/src/mediawiki.htmlform/selectandother.js b/resources/src/mediawiki.htmlform/selectandother.js index 7a643a5683..da90c14620 100644 --- a/resources/src/mediawiki.htmlform/selectandother.js +++ b/resources/src/mediawiki.htmlform/selectandother.js @@ -41,7 +41,7 @@ // cache the current selection to avoid expensive lookup currentValReasonList = $reasonList.val(); - $reasonList.change( function () { + $reasonList.on( 'change', function () { currentValReasonList = $reasonList.val(); } ); diff --git a/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js b/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js index 540de23a72..fdc988bd10 100644 --- a/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js +++ b/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js @@ -1281,7 +1281,7 @@ * @param {Array} nodes List of nodes * @return {string} Other message */ - 'int': function ( nodes ) { + int: function ( nodes ) { var msg = textify( nodes[ 0 ] ); return mw.jqueryMsg.getMessageFunction()( msg.charAt( 0 ).toLowerCase() + msg.slice( 1 ) ); }, diff --git a/resources/src/mediawiki.legacy/protect.js b/resources/src/mediawiki.legacy/protect.js index 2da51222c6..73978d9ba6 100644 --- a/resources/src/mediawiki.legacy/protect.js +++ b/resources/src/mediawiki.legacy/protect.js @@ -19,16 +19,16 @@ } if ( mw.config.get( 'wgCascadeableLevels' ) !== undefined ) { - $( 'form#mw-Protect-Form' ).submit( this.toggleUnchainedInputs.bind( ProtectionForm, true ) ); + $( 'form#mw-Protect-Form' ).on( 'submit', this.toggleUnchainedInputs.bind( ProtectionForm, true ) ); } this.getExpirySelectors().each( function () { - $( this ).change( ProtectionForm.updateExpiryList.bind( ProtectionForm, this ) ); + $( this ).on( 'change', ProtectionForm.updateExpiryList.bind( ProtectionForm, this ) ); } ); this.getExpiryInputs().each( function () { $( this ).on( 'keyup change', ProtectionForm.updateExpiry.bind( ProtectionForm, this ) ); } ); this.getLevelSelectors().each( function () { - $( this ).change( ProtectionForm.updateLevels.bind( ProtectionForm, this ) ); + $( this ).on( 'change', ProtectionForm.updateLevels.bind( ProtectionForm, this ) ); } ); $( '#mwProtectSet > tbody > tr:first' ).after( $row ); @@ -38,7 +38,7 @@ $cell.append( $( '' ) .attr( { id: 'mwProtectUnchained', type: 'checkbox' } ) - .click( this.onChainClick.bind( this ) ) + .on( 'click', this.onChainClick.bind( this ) ) .prop( 'checked', !this.areAllTypesMatching() ), document.createTextNode( ' ' ), $( '