compatibility fixes (#358)

* fix polyfill NodeList forEach

* contentDocument.contains for IE

* polyfill DOMTokenList forEach
This commit is contained in:
jackycoder
2020-09-20 18:55:29 +08:00
committed by GitHub
parent ef84f844ae
commit f8e88ced7b
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 {