bookreader
bookreader copied to clipboard
Fix duplicate SelectionObserver instantiation
What
Consolidates selection-related side effects under a single SelectionObserver instance.
Why
TextSelectionManager was creating multiple SelectionObserver instances for the same layer. This change avoids duplicate observers and ensures consistent attach/detach behavior.
Scope
No user-visible behavior change intended.
Notes
Adds a type guard to ensure classList is accessed only on Element nodes
when walking the DOM.