From 005bb7f2c0e495f24653c103ab4281bde4316364 Mon Sep 17 00:00:00 2001 From: AUTplayed Date: Sat, 3 Aug 2019 13:15:21 +0200 Subject: [PATCH] fix bug with clicking on elements embedded in anchor tags --- ldf.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ldf.js b/ldf.js index 6f470ce..56667ae 100644 --- a/ldf.js +++ b/ldf.js @@ -107,7 +107,18 @@ var ldf = { }, listener: function (e) { e.preventDefault(); - ldf.nav(e.target.getAttribute("href")); + var loc = ""; + if (e.target.tagName === "A") { + loc = e.target.getAttribute("href"); + } else { + for (var i = 1; i < e.path.length; i++) { + if (e.path[i].tagName === "A") { + loc = e.path[i].getAttribute("href"); + break; + } + } + } + ldf.nav(loc); }, request: function (loc, cb) { var req = new XMLHttpRequest();