From f9b3892604922443c401b0892f0677ece3228ce7 Mon Sep 17 00:00:00 2001 From: ciencia Date: Mon, 18 Apr 2022 19:34:43 -0400 Subject: [PATCH] refactor: NodeList.prototype.forEach may not be supported by some browsers --- modules/ext.tabberNeue.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ext.tabberNeue.js b/modules/ext.tabberNeue.js index 951f7d8..4060c79 100644 --- a/modules/ext.tabberNeue.js +++ b/modules/ext.tabberNeue.js @@ -15,7 +15,7 @@ function initTabber( tabber, count ) { var buildTabs = function() { var fragment = new DocumentFragment(); - tabPanels.forEach( function( tabPanel ) { + Array.prototype.forEach.call( tabPanels, function( tabPanel ) { var hash = mw.util.escapeIdForAttribute( tabPanel.title ) + '-' + count, tab = document.createElement( 'a' ); @@ -161,7 +161,7 @@ function initTabber( tabber, count ) { var activeTabs = tabList.querySelectorAll( '.' + ACTIVETABCLASS ); if ( activeTabs.length > 0 ) { - activeTabs.forEach( function( activeTab ) { + Array.prototype.forEach.call( activeTabs, function( activeTab ) { activeTab.classList.remove( ACTIVETABCLASS ); activeTab.setAttribute( 'aria-selected', false ); } ); @@ -232,7 +232,7 @@ function main() { if ( tabbers ) { var count = 0; mw.loader.load( 'ext.tabberNeue.icons' ); - tabbers.forEach( function( tabber ) { + Array.prototype.forEach.call( tabbers, function( tabber ) { initTabber( tabber, count ); count++; } );