Fixed mutation listener stack overflow on Firefox.

This commit is contained in:
Ajay Ramachandran
2020-05-12 21:17:52 -04:00
parent 789bd5939b
commit 55070d5852

View File

@@ -103,9 +103,14 @@ class PreviewBar {
categoryTooltip.classList.add("sbHidden");
});
const observer = new MutationObserver(() => {
const observer = new MutationObserver((mutations, observer) => {
if (!mouseOnSeekBar) return;
// See if mutation observed is only this ID (if so, ignore)
if (mutations.length == 1 && (mutations[0].target as HTMLElement).id === "sponsor-block-category-tooltip") {
return;
}
let tooltips = document.querySelectorAll(".ytp-tooltip-text");
for (const tooltip of tooltips) {
let splitData = tooltip.textContent.split(":");