mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-11 17:02:05 +00:00
refactor: use data-mw- prefix for data attribute
This commit is contained in:
parent
7c760e9593
commit
177c67681e
|
@ -165,7 +165,7 @@ class Tabber {
|
|||
$tabBody = '<p>' . $tabBody . '</p>';
|
||||
}
|
||||
|
||||
return '<article class="tabber__panel" data-title="' . $tabName .
|
||||
return '<article class="tabber__panel" data-mw-tabber-title="' . $tabName .
|
||||
'">' . $tabBody . '</article>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ class TabberTransclude {
|
|||
);
|
||||
}
|
||||
|
||||
$tab = '<article class="tabber__panel" data-title="' . htmlspecialchars( $tabName ) . '"';
|
||||
$tab = '<article class="tabber__panel" data-mw-tabber-title="' . htmlspecialchars( $tabName ) . '"';
|
||||
$tab .= implode( array_map( static function ( $prop, $value ) {
|
||||
return sprintf( ' data-tabber-%s="%s"', $prop, htmlspecialchars( $value ) );
|
||||
}, array_keys( $dataProps ), $dataProps ) );
|
||||
|
|
|
@ -15,7 +15,7 @@ function initApp( tabber ) {
|
|||
};
|
||||
|
||||
tabs.forEach( ( tab ) => {
|
||||
const label = tab.getAttribute( 'data-title' );
|
||||
const label = tab.getAttribute( 'data-mw-tabber-title' );
|
||||
|
||||
tabberData.tabsData.push( {
|
||||
name: mw.util.escapeIdForAttribute( label ),
|
||||
|
|
|
@ -6,7 +6,7 @@ const sizeProperties = Object.freeze( {
|
|||
height: 'offsetHeight'
|
||||
} );
|
||||
|
||||
// Temp element used by various extractTextFromHtml and getActualSize
|
||||
// Temp element used by various extractTextFromHtml
|
||||
const tempElement = document.createElement( 'div' );
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ function getActualSize( element, type ) {
|
|||
const clone = element.cloneNode( true );
|
||||
clone.style.position = 'absolute';
|
||||
clone.style.visibility = 'hidden';
|
||||
tempElement.appendChild( clone );
|
||||
document.body.appendChild( clone );
|
||||
value = clone[ sizeProperties[ type ] ];
|
||||
clone.parentNode.removeChild( clone );
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ function initTabber( tabber, count ) {
|
|||
|
||||
Array.prototype.forEach.call( tabPanels, function ( tabPanel ) {
|
||||
const tab = document.createElement( 'a' );
|
||||
let title = tabPanel.getAttribute( 'data-title' );
|
||||
let title = tabPanel.getAttribute( 'data-mw-tabber-title' );
|
||||
|
||||
if ( config && config.parseTabName ) {
|
||||
tab.innerHTML = title;
|
||||
|
|
|
@ -76,7 +76,7 @@ ve.ce.MWTabberNode.prototype.renderHeader = function ( tabber ) {
|
|||
Array.prototype.forEach.call( tabPanels, function ( tabPanel, index ) {
|
||||
const tab = document.createElement( 'a' );
|
||||
|
||||
tab.innerText = tabPanel.getAttribute( 'data-title' );
|
||||
tab.innerText = tabPanel.getAttribute( 'data-mw-tabber-title' );
|
||||
tab.classList.add( 'tabber__tab' );
|
||||
|
||||
// Make first tab active
|
||||
|
|
|
@ -73,7 +73,7 @@ ve.ce.MWTabberTranscludeNode.prototype.renderHeader = function ( tabber ) {
|
|||
Array.prototype.forEach.call( tabPanels, function ( tabPanel, index ) {
|
||||
const tab = document.createElement( 'a' );
|
||||
|
||||
tab.innerText = tabPanel.getAttribute( 'data-title' );
|
||||
tab.innerText = tabPanel.getAttribute( 'data-mw-tabber-title' );
|
||||
tab.classList.add( 'tabber__tab' );
|
||||
|
||||
// Make first tab active
|
||||
|
|
Loading…
Reference in a new issue