up.fragment.closest(element, selector)
JavaScript function
Returns the first element that matches the selector by testing the element itself and traversing up through ancestors in element's layers.
up.fragment.closest() will only match elements in the same layer as
the given element. To match ancestors regardless of layers, use up.element.closest().
Parameters
element
selector
required
The CSS selector to match.
Type: string
Return value
element The matching element.
Returns null or undefined if no element matches in the same layer.
Type: Element | null | undefined