This PR aims to fix an issue when trying to add an event listener to an element that does not exist anymore. The issue happens when updating the network settings to not display the default CTA banner.
When visiting a book page, the banner is not displayed as expected but the page still tries to add an event listener to the CTA button causing the code to break
How to test
Disable the CTA banner on the network settings
Visit a book page notice the error message
Switch to this branch and make sure the error message is not there when you visit the book again
Enable the CTA banner again and make sure the banner is dismissible
Fixes pressbooks/pressbooks-book#1125
This PR aims to fix an issue when trying to add an event listener to an element that does not exist anymore. The issue happens when updating the network settings to not display the default CTA banner.
When visiting a book page, the banner is not displayed as expected but the page still tries to add an event listener to the CTA button causing the code to break
How to test