From f4d365bf78231394469d6d71c904d29e6a7acd2b Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 14 Jan 2022 00:17:06 -0800 Subject: [PATCH] Fix tracker for IE 11. --- tracker/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tracker/index.js b/tracker/index.js index 99b4df46..a654c097 100644 --- a/tracker/index.js +++ b/tracker/index.js @@ -125,7 +125,8 @@ import { removeTrailingSlash } from '../lib/url'; mutations.forEach(mutation => { const element = mutation.target; addEvent(element); - element.querySelectorAll(eventSelect).forEach(addEvent); + const elements = element.querySelectorAll(eventSelect); + Array.prototype.forEach.call(elements, addEvent); }); }; @@ -168,7 +169,8 @@ import { removeTrailingSlash } from '../lib/url'; switch (document.readyState) { /* DOM rendered, add event listeners */ case 'interactive': { - document.querySelectorAll(eventSelect).forEach(addEvent); + const events = document.querySelectorAll(eventSelect); + Array.prototype.forEach.call(events, addEvent); const observer = new MutationObserver(monitorMutate); observer.observe(document, { childList: true, subtree: true }); break;