Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit 03d9f48

Browse files
committed
fix: allow document.querySelector to instantiate ScrollManager
change `HTMLElement` to `Element` `HTMLElement` extends `Element`
1 parent 8d0307e commit 03d9f48

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/element.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ const windowScrollSize = () =>
3636
)
3737

3838
class ScrollElement {
39-
static isWindow(element: HTMLElement | Window): element is Window {
39+
static isWindow(element: Element | Window): element is Window {
4040
return element === window
4141
}
42-
constructor(private element: HTMLElement | Window = window, private onScroll?: () => void) {
42+
constructor(private element: Element | Window = window, private onScroll?: () => void) {
4343
this.element.addEventListener("scroll", this.scroll)
4444
if (ScrollElement.isWindow(element)) {
4545
this._size = windowSize

src/scroll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Scroll {
3232
private element: ScrollElement
3333
private settings: ISettings
3434
private animationManager: AnimationManager
35-
constructor(element?: HTMLElement | Window, settings: PartialSettings = {}) {
35+
constructor(element?: Element | Window, settings: PartialSettings = {}) {
3636
this.settings = defaultSettings
3737
this.updateSettings(settings)
3838

0 commit comments

Comments
 (0)