* 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)
| 317 | * @return {HTMLElement} The child at index childNum, or null if not found |
| 318 | */ |
| 319 | function getChild(el, childNum, options, includeDragEl) { |
| 320 | let currentChild = 0, |
| 321 | i = 0, |
| 322 | children = el.children; |
| 323 | |
| 324 | while (i < children.length) { |
| 325 | if ( |
| 326 | children[i].style.display !== 'none' && |
| 327 | children[i] !== Sortable.ghost && |
| 328 | (includeDragEl || children[i] !== Sortable.dragged) && |
| 329 | closest(children[i], options.draggable, el, false) |
| 330 | ) { |
| 331 | if (currentChild === childNum) { |
| 332 | return children[i]; |
| 333 | } |
| 334 | currentChild++; |
| 335 | } |
| 336 | |
| 337 | i++; |
| 338 | } |
| 339 | return null; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) |
no test coverage detected
searching dependent graphs…