added mailgoCheckRender on body, not on the document

This commit is contained in:
Matteo Manzinello 2019-05-12 12:13:42 +02:00
parent 9f1e573278
commit df23910808

View File

@ -128,6 +128,7 @@ mailgoInit = () => {
open.classList.add("mailgo-weight-500"); open.classList.add("mailgo-weight-500");
let openContent = document.createTextNode("open"); let openContent = document.createTextNode("open");
open.appendChild(openContent); open.appendChild(openContent);
modalContent.appendChild(open); modalContent.appendChild(open);
// copy // copy
@ -138,6 +139,7 @@ mailgoInit = () => {
copy.classList.add("mailgo-weight-500"); copy.classList.add("mailgo-weight-500");
let copyContent = document.createTextNode("copy"); let copyContent = document.createTextNode("copy");
copy.appendChild(copyContent); copy.appendChild(copyContent);
modalContent.appendChild(copy); modalContent.appendChild(copy);
// by // by
@ -147,6 +149,7 @@ mailgoInit = () => {
by.target = "_blank"; by.target = "_blank";
let textBy = document.createTextNode("mailgo.js.org"); let textBy = document.createTextNode("mailgo.js.org");
by.appendChild(textBy); by.appendChild(textBy);
modalContent.appendChild(by); modalContent.appendChild(by);
// add the modal at the end of the body // add the modal at the end of the body
@ -328,7 +331,7 @@ mailgoCheckRender = event => {
document.addEventListener("DOMContentLoaded", mailgoInit, false); document.addEventListener("DOMContentLoaded", mailgoInit, false);
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered // event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
document.addEventListener("click", mailgoCheckRender, false); document.body.addEventListener("click", mailgoCheckRender, false);
// validate the email with regex // validate the email with regex
validateEmail = email => { validateEmail = email => {