MCPcopy Index your code
hub / github.com/bugy/script-server / closestByClass

Function closestByClass

web-src/src/common/utils/common.js:635–649  ·  view source on GitHub ↗
(element, className)

Source from the content-addressed store, hash-verified

633}
634
635export function closestByClass(element, className) {
636 if (className.startsWith('.')) {
637 className = className.substring(0, className.length - 1);
638 }
639
640 let current = element;
641 while (current != null) {
642 if (hasClass(current, className)) {
643 return current;
644 }
645 current = current.parentNode;
646 }
647
648 return current;
649}
650
651export function toQueryArgs(obj) {
652 const searchParams = new URLSearchParams();

Callers

nothing calls this directly

Calls 1

hasClassFunction · 0.85

Tested by

no test coverage detected