fix polyfill NodeList forEach (#357)
This commit is contained in:
@@ -102,7 +102,6 @@ export class Replayer {
|
|||||||
this.getCastFn = this.getCastFn.bind(this);
|
this.getCastFn = this.getCastFn.bind(this);
|
||||||
this.emitter.on(ReplayerEvents.Resize, this.handleResize as Handler);
|
this.emitter.on(ReplayerEvents.Resize, this.handleResize as Handler);
|
||||||
|
|
||||||
polyfill();
|
|
||||||
this.setupDom();
|
this.setupDom();
|
||||||
|
|
||||||
this.treeIndex = new TreeIndex();
|
this.treeIndex = new TreeIndex();
|
||||||
@@ -330,6 +329,8 @@ export class Replayer {
|
|||||||
this.iframe.contentWindow,
|
this.iframe.contentWindow,
|
||||||
this.iframe.contentDocument,
|
this.iframe.contentDocument,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
polyfill(this.iframe.contentWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -221,9 +221,9 @@ export function isTouchEvent(
|
|||||||
return Boolean((event as TouchEvent).changedTouches);
|
return Boolean((event as TouchEvent).changedTouches);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function polyfill() {
|
export function polyfill(win = window) {
|
||||||
if ('NodeList' in window && !NodeList.prototype.forEach) {
|
if ('NodeList' in win && !win.NodeList.prototype.forEach) {
|
||||||
NodeList.prototype.forEach = (Array.prototype
|
win.NodeList.prototype.forEach = (Array.prototype
|
||||||
.forEach as unknown) as NodeList['forEach'];
|
.forEach as unknown) as NodeList['forEach'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user