Fix for JavaScript bug in IE8

The code currently uses a test for `document.querySelectorAll` to determine if the block after will run. 
The block contains use of `element.addEventListener` which is causing an error in IE8 as IE8 supports `document.querySelectorAll` but not `element.addEventListener`.

https://developer.mozilla.org/en-US/docs/Web/API/Document.querySelectorAll
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener#Browser_compatibility