Skip to content

IDomService

katanakit-js / IDomService

Defined in: types/core/dom.ts:29

Contract of the DOM facade.

useAddClass(target, className): void;

Defined in: types/core/dom.ts:43

Parameter Type
target string | Element
className string

void


useAppend(target, child): void;

Defined in: types/core/dom.ts:64

Parameter Type
target string | Element
child string | Element

void


useCreateElement<T>(tagName, options?): HTMLElementTagNameMap[T];

Defined in: types/core/dom.ts:58

Type Parameter
T extends keyof HTMLElementTagNameMap
Parameter Type
tagName T
options? ElementCreationOptions

HTMLElementTagNameMap[T]


useGetAttribute(target, attr): string | null;

Defined in: types/core/dom.ts:47

Parameter Type
target string | Element
attr string

string | null


useGetBody(): HTMLBodyElement | null;

Defined in: types/core/dom.ts:32

HTMLBodyElement | null


useGetDataAttribute(target, key): string | undefined;

Defined in: types/core/dom.ts:50

Parameter Type
target string | HTMLElement
key string

string | undefined


useGetElementByClass<T>(className): T | null;

Defined in: types/core/dom.ts:34

Type Parameter Default type
T extends HTMLElement HTMLElement
Parameter Type
className string

T | null


useGetElementById<T>(id): T | null;

Defined in: types/core/dom.ts:33

Type Parameter Default type
T extends HTMLElement HTMLElement
Parameter Type
id string

T | null


useGetRoot(): HTMLElement | null;

Defined in: types/core/dom.ts:31

HTMLElement | null


useHasClass(target, className): boolean;

Defined in: types/core/dom.ts:46

Parameter Type
target string | Element
className string

boolean


useIsBrowser(): boolean;

Defined in: types/core/dom.ts:30

boolean


useOn<K>(
target,
event,
callback,
options?
): (() => void) | null;

Defined in: types/core/dom.ts:52

Type Parameter
K extends keyof HTMLElementEventMap
Parameter Type
target string | EventTarget
event K
callback (event) => void
options? boolean | AddEventListenerOptions

(() => void) | null


useQuerySelector<K>(selector): HTMLElementTagNameMap[K] | null;

Defined in: types/core/dom.ts:35

Type Parameter
K extends keyof HTMLElementTagNameMap
Parameter Type
selector K

HTMLElementTagNameMap[K] | null

useQuerySelector<E>(selector): E | null;

Defined in: types/core/dom.ts:38

Type Parameter Default type
E extends Element HTMLElement
Parameter Type
selector string

E | null


useQuerySelectorAll<K>(selector): HTMLElementTagNameMap[K][];

Defined in: types/core/dom.ts:39

Type Parameter
K extends keyof HTMLElementTagNameMap
Parameter Type
selector K

HTMLElementTagNameMap[K][]

useQuerySelectorAll<E>(selector): E[];

Defined in: types/core/dom.ts:42

Type Parameter Default type
E extends Element HTMLElement
Parameter Type
selector string

E[]


useRemove(target): void;

Defined in: types/core/dom.ts:65

Parameter Type
target string | Element

void


useRemoveAttribute(target, attr): void;

Defined in: types/core/dom.ts:49

Parameter Type
target string | Element
attr string

void


useRemoveClass(target, className): void;

Defined in: types/core/dom.ts:44

Parameter Type
target string | Element
className string | string[]

void


useSetAttribute(
target,
attr,
value
): void;

Defined in: types/core/dom.ts:48

Parameter Type
target string | Element
attr string
value string

void


useSetDataAttribute(
target,
key,
value
): void;

Defined in: types/core/dom.ts:51

Parameter Type
target string | HTMLElement
key string
value string

void


useSetHtml(target, html): void;

Defined in: types/core/dom.ts:62

Parameter Type
target string | Element
html string

void


useSetText(target, text): void;

Defined in: types/core/dom.ts:63

Parameter Type
target string | Element
text string

void


useToggleClass(
target,
className,
force?
): boolean | undefined;

Defined in: types/core/dom.ts:45

Parameter Type
target string | Element
className string
force? boolean

boolean | undefined