Skip to content

Commit

Permalink
addEventListener rather than overriding click event
Browse files Browse the repository at this point in the history
  • Loading branch information
stuyam committed Jan 30, 2018
1 parent 4a6b372 commit ca7a034
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/openpixel.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,11 @@ window.addEventListener('unload', function () {
window.onload = function () {
var aTags = document.getElementsByTagName('a');
for (var i = 0, l = aTags.length; i < l; i++) {
aTags[i].onclick = function (e) {
aTags[i].addEventListener('click', function (e) {
if (Url.externalHost(this)) {
Config.externalHost = { link: this.href, time: now() };
}
}.bind(aTags[i]);
}.bind(aTags[i]));
}
};
}(window, document, window["opix"], "opix", "https://tracker.example.com/pixel.gif", 1));
2 changes: 1 addition & 1 deletion dist/openpixel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ window.addEventListener('unload', function() {
window.onload = function() {
var aTags = document.getElementsByTagName('a');
for (var i = 0, l = aTags.length; i < l; i++) {
aTags[i].onclick = function(e) {
aTags[i].addEventListener('click', function(e) {
if(Url.externalHost(this)){
Config.externalHost = {link:this.href, time:now()};
}
}.bind(aTags[i])
}.bind(aTags[i]));
}
}

0 comments on commit ca7a034

Please sign in to comment.