From 69d5af9f7e88167b47a88a7c02e27d88bc9ca6f3 Mon Sep 17 00:00:00 2001 From: Callie Riggins Zetino Date: Tue, 20 Feb 2024 15:47:42 -0800 Subject: [PATCH] Dont parse stylesheets controlled by aphrodite (#249) Check for only the existence of dataset.aphrodite --- src/scroll-timeline-css.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scroll-timeline-css.js b/src/scroll-timeline-css.js index f13d10c..5d3d0b0 100644 --- a/src/scroll-timeline-css.js +++ b/src/scroll-timeline-css.js @@ -31,8 +31,10 @@ function initMutationObserver() { * @param {HtmlStyleElement} el style tag to be parsed */ function handleStyleTag(el) { - // Don’t touch empty style tags. - if (el.innerHTML.trim().length === 0) { + // Don’t touch empty style tags nor tags controlled by aphrodite. + // Details at https://github.com/Khan/aphrodite/blob/master/src/inject.js, + // but any modification to the style tag will break the entire page. + if (el.innerHTML.trim().length === 0 || 'aphrodite' in el.dataset) { return; } // TODO: Do with one pass for better performance