matchParent
Finds the nearest element matching a selector, as Obsidian does: the element itself is checked first, then each ancestor in turn.
Import:
import 'obsidian-test-mocks/setup';Signature:
function matchParent(this: Element, selector: string, lastParent: Element | undefined): Element | nullParameters:
| Parameter | Type | Description |
|---|---|---|
this |
Element | |
selector |
string | The CSS selector to match. |
lastParent |
Element | undefined | An ancestor to stop at; it is still checked, but nothing above it is. |
Returns: Element | null — The element itself or the nearest matching ancestor, or null when none matches.