* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. * The value is returned in real pixels. * @param {HTMLElement} el * @return {Array} Offsets in the format of [left, top]
(el)
| 394 | * @return {Array} Offsets in the format of [left, top] |
| 395 | */ |
| 396 | function getRelativeScrollOffset(el) { |
| 397 | let offsetLeft = 0, |
| 398 | offsetTop = 0, |
| 399 | winScroller = getWindowScrollingElement(); |
| 400 | |
| 401 | if (el) { |
| 402 | do { |
| 403 | let elMatrix = matrix(el), |
| 404 | scaleX = elMatrix.a, |
| 405 | scaleY = elMatrix.d; |
| 406 | |
| 407 | offsetLeft += el.scrollLeft * scaleX; |
| 408 | offsetTop += el.scrollTop * scaleY; |
| 409 | } while (el !== winScroller && (el = el.parentNode)); |
| 410 | } |
| 411 | |
| 412 | return [offsetLeft, offsetTop]; |
| 413 | } |
| 414 | |
| 415 | /** |
| 416 | * Returns the index of the object within the given array |
no test coverage detected
searching dependent graphs…