diff options
Diffstat (limited to 'content-script.js')
-rw-r--r-- | content-script.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/content-script.js b/content-script.js index 4e99e29..82fd3a1 100644 --- a/content-script.js +++ b/content-script.js @@ -16,8 +16,13 @@ // Update our stylesheet content function updateStyles(css) { const stylesheet = getStylesheet(); - stylesheet.textContent = css || ""; - console.log("ZenInternet: Styles were " + (css ? "updated" : "removed")); + // Only update if content has changed to avoid unnecessary reflows + if (stylesheet.textContent !== css) { + stylesheet.textContent = css || ""; + console.log("ZenInternet: Styles were " + (css ? "updated" : "removed")); + } else { + console.log("ZenInternet: Styles unchanged, skipping update"); + } } // Announce content script is ready and provide current hostname |