Skip to content

Commit

Permalink
Dont parse stylesheets controlled by aphrodite (#249)
Browse files Browse the repository at this point in the history
Check for only the existence of dataset.aphrodite
  • Loading branch information
calinoracation committed Feb 20, 2024
1 parent 398b1f6 commit 69d5af9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scroll-timeline-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 69d5af9

Please sign in to comment.