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

Function getChild

Sortable.js:355–369  ·  view source on GitHub ↗

* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible) * and non-draggable elements * @param {HTMLElement} el The parent element * @param {Number} childNum The index of the child * @param {Object} options Parent S

(el, childNum, options, includeDragEl)

Source from the content-addressed store, hash-verified

353 * @return {HTMLElement} The child at index childNum, or null if not found
354 */
355 function getChild(el, childNum, options, includeDragEl) {
356 var currentChild = 0,
357 i = 0,
358 children = el.children;
359 while (i < children.length) {
360 if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
361 if (currentChild === childNum) {
362 return children[i];
363 }
364 currentChild++;
365 }
366 i++;
367 }
368 return null;
369 }
370
371 /**
372 * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)

Callers 4

onSpillFunction · 0.90
_detectDirectionFunction · 0.70
Sortable.jsFile · 0.70
_ghostIsFirstFunction · 0.70

Calls 1

closestFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…