3 ms·
For finding parents matching a selector, there’s a fairly recent addition, Element.closest(). There’s not magnificent support for it yet (notably, no IE), so yo
by chrismorgan 8y ago
For finding parents matching a selector, there’s a fairly recent addition, Element.closest(). There’s not magnificent support for it yet (notably, no IE), so you will probably need a polyfill.