MCPcopy
hub / github.com/Splidejs/splide / toggleClass

Function toggleClass

src/js/utils/dom/toggleClass/toggleClass.ts:11–19  ·  view source on GitHub ↗
( elm: Element, classes: string | string[], add: boolean )

Source from the content-addressed store, hash-verified

9 * @param add - Whether to add or remove a class.
10 */
11export function toggleClass( elm: Element, classes: string | string[], add: boolean ): void {
12 if ( elm ) {
13 forEach( classes, name => {
14 if ( name ) {
15 elm.classList[ add ? 'add' : 'remove' ]( name );
16 }
17 } );
18 }
19}

Callers 9

resizeFunction · 0.90
updateFunction · 0.90
updateFunction · 0.90
updateActivityFunction · 0.90
updateVisibilityFunction · 0.90
mountFunction · 0.90
removeClassFunction · 0.90
addClassFunction · 0.90

Calls 1

forEachFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…