diff options
author | Ajay Ramachandran <[email protected]> | 2020-05-12 21:17:52 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2020-05-12 21:17:52 -0400 |
commit | 55070d585227360ea185b3f98eeb7f2c135cf076 (patch) | |
tree | dbdf1a0f0e97f23902243aef89c7ccad0bfd68e0 | |
parent | 789bd5939bdeeb17946ae11237e7ba8b16ef3e0a (diff) | |
download | SponsorBlock-55070d585227360ea185b3f98eeb7f2c135cf076.tar.gz SponsorBlock-55070d585227360ea185b3f98eeb7f2c135cf076.zip |
Fixed mutation listener stack overflow on Firefox.
-rw-r--r-- | src/js-components/previewBar.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index 2f6ceea3..a7e5c8ec 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -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(":"); |