Custom Element getRootNode.closest() function crossing multiple (parent) shadowDOM boundaries

This does the same as .closest() from inside any child (shadow)DOM but walking up the DOM crossing shadowroot Boundaries Optimized for (extreme) minification //declared as method on a Custom Element: closestElement( selector, // selector like in .closest() base = this, // extra functionality to skip a parent __Closest = (el, found = el && el.closest(selector)) … Read more