MCPcopy Index your code
hub / github.com/SortableJS/Sortable / closest

Function closest

modular/sortable.complete.esm.js:158–170  ·  view source on GitHub ↗
( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX)

Source from the content-addressed store, hash-verified

156 return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
157}
158function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
159 if (el) {
160 ctx = ctx || document;
161 do {
162 if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
163 return el;
164 }
165 if (el === ctx) break;
166 /* jshint boss:true */
167 } while (el = getParentOrHost(el));
168 }
169 return null;
170}
171var R_SPACE = /\s+/g;
172function toggleClass(el, name, state) {
173 if (el && name) {

Callers 4

getChildFunction · 0.70
MultiDragPluginFunction · 0.70

Calls 2

matchesFunction · 0.70
getParentOrHostFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…