Skip to content

Documentation / @ripl/core / closest

Function: closest()

closest<TElement>(element, selector): TElement | undefined

Defined in: packages/core/src/core/query.ts:210

Returns the closest ancestor (including the element itself) matching a CSS-like selector, or undefined.

Type Parameters

Type ParameterDefault type
TElement extends Element<Partial<BaseState>, ElementEventMap>Element<Partial<BaseState>, ElementEventMap>

Parameters

ParameterType
elementQueryable
selectorstring

Returns

TElement | undefined