* 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)
| 390 | * @return {number} |
| 391 | */ |
| 392 | function index(el, selector) { |
| 393 | var index = 0; |
| 394 | if (!el || !el.parentNode) { |
| 395 | return -1; |
| 396 | } |
| 397 | |
| 398 | /* jshint boss:true */ |
| 399 | while (el = el.previousElementSibling) { |
| 400 | if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { |
| 401 | index++; |
| 402 | } |
| 403 | } |
| 404 | return index; |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. |
no test coverage detected
searching dependent graphs…