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