Refactor anchor browsing to avoid mixing selector logic with data attributes