findClosestMatchingNode
Finds the closest matching node starting at the given node
.
- Use a
for
loop andNode.parentNode
to traverse the node tree upwards from the givennode
. - Use
Element.matches()
to check if any given element node matches the providedselector
. - If no matching node is found, return
null
.