fix: scope logo palette inline script to avoid global collisions#4542
Open
Alexia-Soare wants to merge 1 commit into
Open
fix: scope logo palette inline script to avoid global collisions#4542Alexia-Soare wants to merge 1 commit into
Alexia-Soare wants to merge 1 commit into
Conversation
Wrap the toggle script in an IIFE so `html` and friends no longer leak as page globals, and filter the MutationObserver to `data-neve-theme`. Fixes the `html.getAttribute is not a function` error thrown when a third-party script clobbers the global `html`. Fixes #4541 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Alexia-Soare
requested review from
Soare-Robert-Daniel and
Copilot
and removed request for
Copilot
July 16, 2026 06:46
Collaborator
Soare-Robert-Daniel
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4541
Summary
The logo palette inline script declared
var html(and other variables) in the page's global scope and dereferenced it later in a MutationObserver callback. If any third-party script reassigned the globalhtml, the callback threwUncaught TypeError: html.getAttribute is not a functionon the next attribute change on<html>.Changes
htmlrenamed tohtmlEl; leading;guards against unsafe concatenation inScript_Register).attributeFilter: ['data-neve-theme']so the observer only fires for the attribute it cares about, instead of every mutation on the root element.No behavior change otherwise: palette-based logo swapping works exactly as before.