fix: error when target not an html element (#29523)

fix error when target is object but not an html element
This commit is contained in:
bcd337 2021-02-26 17:43:15 +07:00 committed by GitHub
parent 4d3b2d87c1
commit 290aa1adf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ export default function getScroll(
result = (target as HTMLElement)[method];
}
if (target && !isWindow(target) && typeof result !== 'number') {
result = ((target as HTMLElement).ownerDocument || (target as Document)).documentElement[
result = ((target as HTMLElement).ownerDocument || (target as Document)).documentElement?.[
method
];
}