console.log('site loaded'); (function () { var clickEvent = function (event) { let anchor = event.target.closest('a'); if (anchor != null && anchor.href.startsWith(window.location.origin)) { event.preventDefault(); let relativeHref = anchor.href.replace(window.location.origin, ''); console.log(relativeHref); //document.dispatchEvent(new CustomEvent('siteHelper:navigate', { detail: { href: relativeHref }})); } }; if (Element.prototype.closest) { //document.addEventListener("click", clickEvent, true); } })(); (function () { var clickEvent = function (event) { console.log('event.target.oasis'); console.log(event.target); let anchorCount = document.querySelectorAll('a').length; console.log(anchorCount); }; //document.addEventListener("click", clickEvent, true); })();