Skip to content

Commit

Permalink
Fix tracker for IE 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Jan 14, 2022
1 parent 489d46f commit f4d365b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tracker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f4d365b

Please sign in to comment.