Fix onclick listeners for non-<a> elements

pull/37/head
Nikita Karamov 2021-07-29 15:13:59 +02:00
parent 0fd35925b5
commit a80fd2e5bd
No known key found for this signature in database
GPG Key ID: 7FCADEDBB1AEBE44
1 changed files with 2 additions and 4 deletions

View File

@ -103,11 +103,9 @@ const shareon = () => {
child.setAttribute('rel', 'noopener noreferrer'); child.setAttribute('rel', 'noopener noreferrer');
child.setAttribute('target', '_blank'); child.setAttribute('target', '_blank');
} else { } else {
const getButtonListener = (buttonUrl) => () => { child.onclick = () => {
window.open(buttonUrl, '_blank', 'noopener,noreferrer'); window.open(url, '_blank', 'noopener,noreferrer');
}; };
child.addEventListener('click', getButtonListener(url));
} }
break; // once a network is detected we don't want to check further break; // once a network is detected we don't want to check further