dom.ts

Declarations
#

6 declarations

view source

handle_target_value
#

dom.ts view source

(cb: (value: any, event: any) => void, swallow_event?: boolean): (e: any) => void

Handles the value of an event's target and invokes a callback. Defaults to swallowing the event to prevent default actions and propagation.

cb

type (value: any, event: any) => void

swallow_event

type boolean
default true

returns

(e: any) => void

inside_editable
#

dom.ts view source

(el: Element): boolean

Returns true if the element is within a contenteditable ancestor.

el

type Element

returns

boolean

is_editable
#

dom.ts view source

(el: any): boolean

Checks if the given element is editable. Returns true for text-based input types, textareas, and contenteditable elements.

el

type any

returns

boolean

is_iframed
#

dom.ts view source

(): boolean

Returns a boolean indicating if the current browser window, if any, is iframed inside of another.

returns

boolean

is_interactive
#

dom.ts view source

(el: any): boolean

Checks if the element is interactive (clickable, focusable, or otherwise accepts user input). Returns true for buttons, links, form controls, and elements with interactive attributes and ARIA roles.

el

type any

returns

boolean

swallow
#

dom.ts view source

<T extends Pick<Event, "preventDefault" | "stopPropagation" | "stopImmediatePropagation">>(event: T, immediate?: boolean, preventDefault?: boolean): T

Stops an event from bubbling and doing default behavior.

event

type T

immediate

defaults to true to use stopImmediatePropagation over stopPropagation

type boolean
default true

preventDefault

defaults to true

type boolean
default true

returns

T