compatibility fixes (#358)

* fix polyfill NodeList forEach

* contentDocument.contains for IE

* polyfill DOMTokenList forEach
This commit is contained in:
jackycoder
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 28d599f91b
commit 9af39386d4
2 changed files with 14 additions and 1 deletions

View File

@@ -226,6 +226,11 @@ export function polyfill(win = window) {
win.NodeList.prototype.forEach = (Array.prototype
.forEach as unknown) as NodeList['forEach'];
}
if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {
win.DOMTokenList.prototype.forEach = (Array.prototype
.forEach as unknown) as DOMTokenList['forEach'];
}
}
export function needCastInSyncMode(event: eventWithTime): boolean {