* Returns the index of an element within its parent for a selected set of * elements * @param {HTMLElement} el * @param {selector} selector * @return {number}
(el, selector)
| 384 | * @return {number} |
| 385 | */ |
| 386 | function index(el, selector) { |
| 387 | var index = 0; |
| 388 | if (!el || !el.parentNode) { |
| 389 | return -1; |
| 390 | } |
| 391 | |
| 392 | /* jshint boss:true */ |
| 393 | while (el = el.previousElementSibling) { |
| 394 | if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { |
| 395 | index++; |
| 396 | } |
| 397 | } |
| 398 | return index; |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. |
no test coverage detected
searching dependent graphs…