fix ISSUE #23
This commit is contained in:
parent
6d81e1debd
commit
dab541edaa
26
dist/mailgo.js
vendored
26
dist/mailgo.js
vendored
@ -265,20 +265,22 @@ var actions = {
|
||||
*/
|
||||
|
||||
var mailgoCheckRender = function mailgoCheckRender(event) {
|
||||
// the target element
|
||||
var e = event.target; // check if the id=mailgo exists in the body
|
||||
// check if the id=mailgo exists in the body
|
||||
if (!document.contains(getE("mailgo"))) return; // go in the event.path to find if the user has clicked on a mailgo element
|
||||
|
||||
if (!document.contains(getE("mailgo"))) return;
|
||||
event.path.forEach(function (e) {
|
||||
if ( // first case: it is an <a> element with "mailto:..." in href and no no-mailgo in classList
|
||||
e.href && e.href.toLowerCase().startsWith(MAILTO) && !e.classList.contains("no-mailgo") || // second case: the href=#mailgo
|
||||
e.href && e.getAttribute("href").toLowerCase() === "#mailgo" || // third case: the classList contains mailgo
|
||||
e.classList.contains("mailgo")) {
|
||||
// stop the normal execution of the element click
|
||||
event.preventDefault(); // render mailgo
|
||||
|
||||
if ( // first case: it is an <a> element with "mailto:..." in href and no no-mailgo in classList
|
||||
e.href && e.href.toLowerCase().startsWith(MAILTO) && !e.classList.contains("no-mailgo") || // second case: the href=#mailgo
|
||||
e.href && e.getAttribute("href").toLowerCase() === "#mailgo" || // third case: the classList contains mailgo
|
||||
e.classList.contains("mailgo")) {
|
||||
// stop the normal execution of the element click
|
||||
event.preventDefault(); // render mailgo
|
||||
|
||||
mailgoRender(e);
|
||||
}
|
||||
mailgoRender(e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
return;
|
||||
};
|
||||
/**
|
||||
* mailgoKeydown
|
||||
|
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
@ -328,28 +328,32 @@ const actions = {
|
||||
* );
|
||||
*/
|
||||
const mailgoCheckRender = event => {
|
||||
// the target element
|
||||
let e = event.target;
|
||||
|
||||
// check if the id=mailgo exists in the body
|
||||
if (!document.contains(getE("mailgo"))) return;
|
||||
|
||||
if (
|
||||
// first case: it is an <a> element with "mailto:..." in href and no no-mailgo in classList
|
||||
(e.href &&
|
||||
e.href.toLowerCase().startsWith(MAILTO) &&
|
||||
!e.classList.contains("no-mailgo")) ||
|
||||
// second case: the href=#mailgo
|
||||
(e.href && e.getAttribute("href").toLowerCase() === "#mailgo") ||
|
||||
// third case: the classList contains mailgo
|
||||
e.classList.contains("mailgo")
|
||||
) {
|
||||
// stop the normal execution of the element click
|
||||
event.preventDefault();
|
||||
// go in the event.path to find if the user has clicked on a mailgo element
|
||||
event.path.forEach(e => {
|
||||
if (
|
||||
// first case: it is an <a> element with "mailto:..." in href and no no-mailgo in classList
|
||||
(e.href &&
|
||||
e.href.toLowerCase().startsWith(MAILTO) &&
|
||||
!e.classList.contains("no-mailgo")) ||
|
||||
// second case: the href=#mailgo
|
||||
(e.href && e.getAttribute("href").toLowerCase() === "#mailgo") ||
|
||||
// third case: the classList contains mailgo
|
||||
e.classList.contains("mailgo")
|
||||
) {
|
||||
// stop the normal execution of the element click
|
||||
event.preventDefault();
|
||||
|
||||
// render mailgo
|
||||
mailgoRender(e);
|
||||
}
|
||||
// render mailgo
|
||||
mailgoRender(e);
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user