Skip to content

Commit 28c9982

Browse files
authored
fix: Temporarily dropping shadow dom support as it breaks with anchor elements (#76)
* fix(TS): Element.host now provided by TS dom lib * Update index.ts * Update index.ts * Shadow dom implementation is incompatible with anchors * Update index.ts * Sync with Prettier * Update index.ts
1 parent 7d44ba6 commit 28c9982

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/index.ts

+3-12
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ declare global {
2222
width: number
2323
}
2424
}
25-
26-
// @TODO better declaration of possible shadowdom hosts
27-
interface Element {
28-
host: any
29-
}
3025
}
3126

3227
type ScrollLogicalPosition = 'start' | 'center' | 'end' | 'nearest'
@@ -55,11 +50,7 @@ interface CustomScrollAction {
5550

5651
// @TODO better shadowdom test, 11 = document fragment
5752
function isElement(el: any) {
58-
return (
59-
el != null &&
60-
typeof el === 'object' &&
61-
(el.nodeType === 1 || el.nodeType === 11)
62-
)
53+
return el != null && typeof el === 'object' && el.nodeType === 1
6354
}
6455

6556
function canOverflow(
@@ -251,8 +242,8 @@ export default (target: Element, options: Options): CustomScrollAction[] => {
251242
const frames: Element[] = []
252243
let cursor = target
253244
while (isElement(cursor) && checkBoundary(cursor)) {
254-
// Move cursor to parent or shadow dom host
255-
cursor = cursor.parentNode || cursor.host
245+
// Move cursor to parent
246+
cursor = cursor.parentNode as Element
256247

257248
// Stop when we reach the viewport
258249
if (cursor === scrollingElement) {

0 commit comments

Comments
 (0)