Skip to content

Commit

Permalink
feat(core): ✨ check parent container for table nowrap class
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed May 1, 2023
1 parent 3d14f9c commit 587cea1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions resources/skins.citizen.scripts/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,20 @@ function setupOverflowState( element ) {
function wrapTable( table ) {
// TODO: Make this a config flag
const ignoredClasses = [
'citizen-table-nowrap',
'infobox'
];

const hasIgnoredClass = ( ignoreClass ) => table.classList.contains( ignoreClass );
'citizen-table-nowrap',
'infobox'
];

// Check table and parent for ignored classes
const hasIgnoredClass = ( ignoreClass ) => {
return table.classList.contains( ignoreClass ) ||
table.parentNode.classList.contains( ignoreClass );
};

// Return if table has one of the ignored classes
if ( ignoredClasses.some( hasIgnoredClass ) ) { return; }
// Return if table has one of the ignored classes
if ( ignoredClasses.some( hasIgnoredClass ) ) {
return;
}

const wrapper = document.createElement( 'div' );

Expand Down

0 comments on commit 587cea1

Please sign in to comment.