mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-12 01:15:27 +00:00
refactor: use documentFragment for buildTabs
This commit is contained in:
parent
775d38e36a
commit
45fb952d2d
|
@ -13,11 +13,7 @@ function initTabber( tabber ) {
|
|||
nextButton = document.createElement( 'div' );
|
||||
|
||||
const buildTabs = () => {
|
||||
container.classList.add( 'tabber__header' );
|
||||
tablist.classList.add( 'tabber__nav' );
|
||||
tablist.setAttribute( 'role', 'tablist' );
|
||||
prevButton.classList.add( 'tabber__header__prev' );
|
||||
nextButton.classList.add( 'tabber__header__next' );
|
||||
const fragment = new DocumentFragment();
|
||||
|
||||
[ ...tabPanels ].forEach( ( tabPanel ) => {
|
||||
const hash = mw.util.escapeIdForAttribute( tabPanel.title ) + '-' + key,
|
||||
|
@ -36,9 +32,17 @@ function initTabber( tabber ) {
|
|||
tab.setAttribute( 'id', 'tab-' + hash );
|
||||
tab.setAttribute( 'aria-controls', hash );
|
||||
|
||||
tablist.append( tab );
|
||||
fragment.append( tab );
|
||||
} );
|
||||
|
||||
tablist.append( fragment );
|
||||
|
||||
container.classList.add( 'tabber__header' );
|
||||
tablist.classList.add( 'tabber__nav' );
|
||||
tablist.setAttribute( 'role', 'tablist' );
|
||||
prevButton.classList.add( 'tabber__header__prev' );
|
||||
nextButton.classList.add( 'tabber__header__next' );
|
||||
|
||||
container.append( prevButton, tablist, nextButton );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue