1
0
mirror of https://github.com/thangisme/notes.git synced 2024-12-22 14:06:39 -05:00

Fixed js browser incompatibility

(cherry picked from commit d39b7b3041d1bdb9f80ab7f5878e64a3b3b79b5d)
This commit is contained in:
Silvio Giebl 2019-08-10 23:20:29 +02:00
parent 8e6e3dddd3
commit 6bd43a1332

View File

@ -25,10 +25,13 @@ jtd.onReady = function(ready) {
function initNav() {
jtd.addEvent(document, 'click', function(e){
var expander = e.path.find(function(x){ return x.classList && x.classList.contains('nav-list-expander') });
if (expander) {
var target = e.target;
while (target && target.classList && !target.classList.contains('nav-list-expander')) {
target = target.parentElement;
}
if (target) {
e.preventDefault();
expander.parentElement.classList.toggle('active');
target.parentElement.classList.toggle('active');
}
});