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

Function getChild

modular/sortable.complete.esm.js:349–363  ·  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 Sortable'

(el, childNum, options, includeDragEl)

Source from the content-addressed store, hash-verified

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

Callers 3

_detectDirectionFunction · 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…