Skip to content

fix: scope logo palette inline script to avoid global collisions#4542

Open
Alexia-Soare wants to merge 1 commit into
developmentfrom
fix/4541-logo-palette-global-scope
Open

fix: scope logo palette inline script to avoid global collisions#4542
Alexia-Soare wants to merge 1 commit into
developmentfrom
fix/4541-logo-palette-global-scope

Conversation

@Alexia-Soare

@Alexia-Soare Alexia-Soare commented Jul 16, 2026

Copy link
Copy Markdown

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 global html, the callback threw Uncaught TypeError: html.getAttribute is not a function on the next attribute change on <html>.

Changes

  • Wrapped the inline script in an IIFE — no more page globals to collide with (html renamed to htmlEl; leading ; guards against unsafe concatenation in Script_Register).
  • Added 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.

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 Alexia-Soare added the pr-checklist-skip Allow this Pull Request to skip checklist. label Jul 16, 2026
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 16, 2026
@Alexia-Soare
Alexia-Soare requested review from Soare-Robert-Daniel and Copilot and removed request for Copilot July 16, 2026 06:46
@pirate-bot

Copy link
Copy Markdown
Collaborator

Plugin build for 2b2671d is ready 🛎️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants