Home Reference Source Repository
public class | source

ClassList

See:

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get
public

tokens: *

Method Summary

Public Methods
public

add(tokens: ...string)

Adds a class to an element's list of classes

public

Checks if an element's list of classes contains a specific class

public

remove(tokens: ...string)

Removes a class from an element's list of classes

public

toggle(token: string, force: boolean): boolean

Toggles the existence of a class in an element's list of classes

Public Constructors

public constructor(element: HTMLElement) source

Params:

NameTypeAttributeDescription
element HTMLElement

Public Members

public get length: number source

public tokens: * source

Public Methods

public add(tokens: ...string) source

Adds a class to an element's list of classes

Params:

NameTypeAttributeDescription
tokens ...string

public contains(token: string): boolean source

Checks if an element's list of classes contains a specific class

Params:

NameTypeAttributeDescription
token string

Return:

boolean

if the token is present

public remove(tokens: ...string) source

Removes a class from an element's list of classes

Params:

NameTypeAttributeDescription
tokens ...string

public toggle(token: string, force: boolean): boolean source

Toggles the existence of a class in an element's list of classes

Params:

NameTypeAttributeDescription
token string
force boolean

Return:

boolean

if the token was added