ancestor

Any node above a given node in the DOM tree: its parent, the parent's parent and so on up to the document.

In more detail

parentNode and parentElement give the direct parent. closest() walks up the ancestor chain to find the nearest match, and events bubble up through the same chain.

Related terms

Taught in

References