From 80b7d7cbe4294399aa65f434065e043819be254f Mon Sep 17 00:00:00 2001 From: Gibheer Date: Thu, 24 Jan 2019 12:01:21 +0100 Subject: monfront - firefox has no event.path Because Firefox has no attribute path for an event to represent the element chain of the target, we need to iterate through the parents. --- cmd/monfront/main.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cmd/monfront/main.go b/cmd/monfront/main.go index 1fccb95..605b4e7 100644 --- a/cmd/monfront/main.go +++ b/cmd/monfront/main.go @@ -643,16 +643,22 @@ var ( if (event.target.nodeName == 'INPUT') { return; } - for (i = 0; i < event.path.length; i++) { - if (event.path[i].nodeName != 'TR') { + current = event.target; + while (current = current.parentNode) { + if (current,nodeName == 'BODY') { + break; + } + if (current.nodeName != 'TR') { continue; } - e = event.path[i].children[0].children[0]; - e.checked = !e.checked; + e = current.children[0].children[0]; + if (e != event.target) { + e.checked = !e.checked; + } if (e.checked) { - event.path[i].classList.add("selected"); + current.classList.add("selected"); } else { - event.path[i].classList.remove("selected"); + current.classList.remove("selected"); } e.focus(); break; -- cgit v1.2.3-70-g09d2