avoid adding # to the page URL when clicking dummy links (#1006)

This commit is contained in:
tophf 2020-07-30 04:30:00 +03:00 committed by GitHub
parent c43315e697
commit 7e7839bb1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,6 +85,12 @@ onDOMready().then(() => {
// set language for CSS :lang and [FF-only] hyphenation
document.documentElement.setAttribute('lang', chrome.i18n.getUILanguage());
// avoid adding # to the page URL when clicking dummy links
document.addEventListener('click', e => {
if (e.target.closest('a[href="#"]')) {
e.preventDefault();
}
});
function onDOMready() {
if (document.readyState !== 'loading') {