Skip to content

Commit c9a756c

Browse files
Use addEventListener for mailto links
1 parent 69e892b commit c9a756c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/auto-events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176

177177
link.setAttribute("onclick", onClickAttribute);
178178
} else {
179-
link.on("click", function () {
179+
link.addEventListener("click", function () {
180180
saAutomatedLink(collect);
181181
});
182182
}
@@ -194,7 +194,7 @@
194194
if (!link.getAttribute("href")) continue;
195195

196196
// We don't want to overwrite website behaviour so we check for the onclick attribute
197-
if (!link.getAttribute("onclick")) {
197+
if (!link.getAttribute("onclick") && !/^mailto:/.test(href)) {
198198
collectLink(link, true);
199199
} else {
200200
collectLink(link, false);

0 commit comments

Comments
 (0)