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

Function closest

Sortable.js:164–176  ·  view source on GitHub ↗
( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX)

Source from the content-addressed store, hash-verified

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

Callers 6

dropFunction · 0.90
_deselectMultiDragFunction · 0.90
getChildFunction · 0.70
Sortable.jsFile · 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…