Closest ancestor matching selector using native DOM?
Is anybody working on a jQuery.closest() equivalent in the DOM api? Looks like the Selectors Level 2 draft adds matches() equivalent to jQuery.is() , so native closest should be much easier to write. Has adding closest() to Selectors come up? Element.closest() its support Implementing such function with Element.matches() seems not optimal in terms of performance, cause apparently matches() will make a call to querySelectorAll() every time you test a parent, while only one call is sufficient for the job. Here's a polyfill for closest() on MDN. Note a single call to querySelectorAll() if (window