dispatch event listener problem after click
e.preventDefault();
e.stopPropagation();

if (e.target.nextElementSibling == null) {

    if (e.target.getAttribute('target') != null) {
        window.open(e.target.getAttribute('href'), e.target.getAttribute('target'));
    } else {
        window.location.href = e.target.getAttribute('href');
    }
}

Change that part to:
if (e.target.nextElementSibling == null) {
    return;
}

e.preventDefault();
e.stopPropagation();