Created
October 11, 2018 17:33
-
-
Save schalkneethling/0e34834fa3d9cd0fc6b792adfbb1ebc2 to your computer and use it in GitHub Desktop.
Snippet used in Preventing SVG from becoming the event.target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mainDocument = document.getElementById('document-main'); | |
mainDocument.addEventListener('click', function(event) { | |
var target = event.target; | |
// only handle clicks on anchor elements | |
if (target.tagName === 'A') { | |
// do stuff | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment