refactor: NodeList.prototype.forEach may not be supported by some browsers

This commit is contained in:
ciencia 2022-04-18 19:34:43 -04:00 committed by alistair3149
parent c46b918b04
commit f9b3892604
No known key found for this signature in database
GPG key ID: 94D081060FD3DD9C

View file

@ -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++;
} );