* 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)
| 411 | * @return {Array} Offsets in the format of [left, top] |
| 412 | */ |
| 413 | function getRelativeScrollOffset(el) { |
| 414 | var offsetLeft = 0, |
| 415 | offsetTop = 0, |
| 416 | winScroller = getWindowScrollingElement(); |
| 417 | if (el) { |
| 418 | do { |
| 419 | var elMatrix = matrix(el), |
| 420 | scaleX = elMatrix.a, |
| 421 | scaleY = elMatrix.d; |
| 422 | offsetLeft += el.scrollLeft * scaleX; |
| 423 | offsetTop += el.scrollTop * scaleY; |
| 424 | } while (el !== winScroller && (el = el.parentNode)); |
| 425 | } |
| 426 | return [offsetLeft, offsetTop]; |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Returns the index of the object within the given array |
no test coverage detected
searching dependent graphs…