Glossary Term
Element.closest()
3 tags
1 category
The closest() method of the Element interface traverses the element and its parents (heading toward the document root) until it finds a node that matches the specified CSS selector.
Inputs: selectors A string of valid CSS selectors to match the Element and its ancestors against.
Returns: The closest ancestor Element or itself, which matches the selectors. If there is no such element, null is returned.
Exceptions: SyntaxError DOMException Thrown if the selectors is not a valid CSS selector.
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
