From 1f75afc2174994fe9894c534d6276e2956394fed Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Sat, 16 Nov 2024 03:08:26 -0500 Subject: [PATCH] fix: various issues found in code review --- includes/Tabber.php | 2 +- modules/ext.tabberNeue/ext.tabberNeue.js | 5 +++-- modules/ve-tabberNeue/ve.ce.MWTabberTranscludeNode.js | 3 --- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/Tabber.php b/includes/Tabber.php index 9ad4996..3fd9a01 100644 --- a/includes/Tabber.php +++ b/includes/Tabber.php @@ -63,7 +63,7 @@ class Tabber { $html = self::render( $input, $count, $parser, $frame ); - $parserOutput->appendExtensionData( 'tabber-count', $count++ ); + $parserOutput->appendExtensionData( 'tabber-count', ++$count ); if ( self::$useCodex === true ) { $parser->getOutput()->addModules( [ 'ext.tabberNeue.codex' ] ); diff --git a/modules/ext.tabberNeue/ext.tabberNeue.js b/modules/ext.tabberNeue/ext.tabberNeue.js index 116d5a9..d48eb11 100644 --- a/modules/ext.tabberNeue/ext.tabberNeue.js +++ b/modules/ext.tabberNeue/ext.tabberNeue.js @@ -424,8 +424,9 @@ class TabberBuilder { if ( !urlHash ) { return activeTab; } - const idFromUrlHash = urlHash.replace( 'tabber-tabpanel-', 'tabber-tab-' ); - if ( idFromUrlHash === urlHash ) { + const escapedHash = mw.util.escapeIdForAttribute( urlHash ); + const idFromUrlHash = escapedHash.replace( 'tabber-tabpanel-', 'tabber-tab-' ); + if ( idFromUrlHash === escapedHash ) { return activeTab; } const activeTabFromUrlHash = document.getElementById( idFromUrlHash ); diff --git a/modules/ve-tabberNeue/ve.ce.MWTabberTranscludeNode.js b/modules/ve-tabberNeue/ve.ce.MWTabberTranscludeNode.js index aaf6a77..73279bd 100644 --- a/modules/ve-tabberNeue/ve.ce.MWTabberTranscludeNode.js +++ b/modules/ve-tabberNeue/ve.ce.MWTabberTranscludeNode.js @@ -33,9 +33,6 @@ ve.ce.MWTabberTranscludeNode.static.primaryCommandName = 'mwTabberTransclude'; ve.ce.MWTabberTranscludeNode.static.lastHeader = null; /* Methods */ -// eslint-disable-next-line no-var -var lastHeader; - /** * @inheritdoc */