(scrollTop)
| 69 | |
| 70 | source: { |
| 71 | scrollTo(scrollTop) { |
| 72 | const { element } = instance; |
| 73 | if (element === null) { |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | // Measure the position again, in case content above the component has changed size since it was last measured |
| 78 | const targetElement = instance.target.getElement(); |
| 79 | const positionFromTop = targetElement |
| 80 | ? getPositionOffset(targetElement, element).top |
| 81 | : 0; |
| 82 | |
| 83 | const scrollOffset = getScrollOffset(element); |
| 84 | const top = scrollTop + positionFromTop; |
| 85 | if (Math.abs(scrollOffset.top - top) < 1) { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | if (typeof element.scrollTo === "function") { |
| 90 | // Preserve the current horizontal scroll position |
| 91 | element.scrollTo(scrollOffset.left, top); |
| 92 | } else { |
| 93 | (element as Element).scrollTop = top; |
| 94 | } |
| 95 | return true; |
| 96 | } |
| 97 | }, |
| 98 | |
| 99 | update(isScrolling) { |
nothing calls this directly
no test coverage detected