aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/mediawiki.action
diff options
context:
space:
mode:
authorEbrahim Byagowi <ebrahim@gnu.org>2024-07-07 23:21:45 +0330
committerEbrahim Byagowi <ebrahim@gnu.org>2024-07-08 00:08:29 +0330
commite8002b9fa43657a84e320f89f3e4638cc9a53b71 (patch)
tree8ab32f7e1154a8407b41fb69bc6ef598f37c6f22 /resources/src/mediawiki.action
parent41e384528d3eb1d9f1dbead5a43fe93de4e4a64d (diff)
downloadmediawikicore-e8002b9fa43657a84e320f89f3e4638cc9a53b71.tar.gz
mediawikicore-e8002b9fa43657a84e320f89f3e4638cc9a53b71.zip
Drop an extra early return in mediawiki.action.history
This shouldn't be needed as iterating over an empty array is no-op anyway. Also 'use strict' and ES6 let/const. Change-Id: I5f1073dbcfcc42d8e10fec191b35d7aca293d104
Diffstat (limited to 'resources/src/mediawiki.action')
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.history.js25
1 files changed, 9 insertions, 16 deletions
diff --git a/resources/src/mediawiki.action/mediawiki.action.history.js b/resources/src/mediawiki.action/mediawiki.action.history.js
index 1782f3c4ca30..a584ff307c4b 100644
--- a/resources/src/mediawiki.action/mediawiki.action.history.js
+++ b/resources/src/mediawiki.action/mediawiki.action.history.js
@@ -2,9 +2,10 @@
* JavaScript for History action
*/
$( () => {
- var
- $pagehistory = $( '#pagehistory' ),
- $lis = $pagehistory.find( '.mw-contributions-list > li' );
+ 'use strict';
+
+ const $pagehistory = $( '#pagehistory' );
+ const $lis = $pagehistory.find( '.mw-contributions-list > li' );
/**
* @ignore
@@ -13,21 +14,13 @@ $( () => {
* @return {boolean} False to cancel the default event
*/
function updateDiffRadios() {
- var nextState = 'before',
- $li,
- $inputs,
- $oldidRadio,
- $diffRadio;
-
- if ( !$lis.length ) {
- return true;
- }
+ let nextState = 'before';
$lis.each( function () {
- $li = $( this );
- $inputs = $li.find( 'input[type="radio"]' );
- $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq( 0 );
- $diffRadio = $inputs.filter( '[name="diff"]' ).eq( 0 );
+ const $li = $( this );
+ const $inputs = $li.find( 'input[type="radio"]' );
+ const $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq( 0 );
+ const $diffRadio = $inputs.filter( '[name="diff"]' ).eq( 0 );
$li.removeClass( 'selected between before after' );