fix: theme toggle survives hx-boost navigation via event delegation
hx-boost replaces <body> on every navigation — a click listener bound to the button element in DOMContentLoaded dies when the old element is swapped out.
Replaced initThemeToggle + DOMContentLoaded with a single delegated listener on document. The listener checks e.target.closest('#navbar-theme-btn') so it only fires for the theme button. Lives for the lifetime of the tab, immune to any number of HTMX body swaps.
localStorage read/write and data-theme toggling logic unchanged.
sha256:dec6f7e1e2fce2b19b9ab18215e232f17009ff7ff51718359655b54c07259626
sha
sha256:505c9a95fb846313a3aa4f96cfa1c558198c97b2eac22da166513631fb9f516d
snapshot
0 comments
To add a comment, use the Muse CLI:
muse hub commit comment sha256:dec6f7e1e2fce2b19b9ab18215e232f17009ff7ff51718359655b54c07259626 --body "your comment"
No comments yet. Be the first to start the discussion.