fix polyfill NodeList forEach (#357)

This commit is contained in:
jackycoder
2020-09-20 15:25:50 +08:00
committed by GitHub
parent 64efb8c242
commit ef84f844ae
2 changed files with 5 additions and 4 deletions

View File

@@ -221,9 +221,9 @@ export function isTouchEvent(
return Boolean((event as TouchEvent).changedTouches);
}
export function polyfill() {
if ('NodeList' in window && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = (Array.prototype
export function polyfill(win = window) {
if ('NodeList' in win && !win.NodeList.prototype.forEach) {
win.NodeList.prototype.forEach = (Array.prototype
.forEach as unknown) as NodeList['forEach'];
}
}