Exclusion; move popup-specific logic to its own class.
Exclusions; use querySelector to find sub-elements.

As @philc pointed out in #1366, this is less brittle.