MyopicVicar icon indicating copy to clipboard operation
MyopicVicar copied to clipboard

Verify elements are non-null before adding event listener

Open galactic-src opened this issue 2 years ago • 0 comments

When loading www.freecen.org.uk, I see a few console errors. Two of these are Uncaught TypeError: Cannot read properties of null (reading 'addEventListener').

This change checks the elements having click listeners attached are truthy before reading their addEventListener (or attachEvent) attributes. It also future-proofs the subsequent check for element #trigger-offcanvas-old.

galactic-src avatar Jun 15 '22 07:06 galactic-src