refactor(ajax-collection-links): Use event delegation for collection links
This commit refactors the event handling for the AJAX collection links to improve performance and robustness.
Previously, the script queried for all collection links and attached an individual click event listener to each one using forEach.
This has been replaced with a single, delegated event listener attached to the static #sidebar parent element. The handler now intelligently checks if the event.target (or its ancestor) is a matching collection link.
This approach:
- Is more performant, as it only requires one event listener regardless of the number of links.
- Is more robust, as it will automatically handle any collection links that are dynamically added to the sidebar after the initial page load.