diff options
author | Gibheer <gibheer+git@zero-knowledge.org> | 2019-01-24 12:01:21 +0100 |
---|---|---|
committer | Gibheer <gibheer+git@zero-knowledge.org> | 2019-01-24 12:01:21 +0100 |
commit | 80b7d7cbe4294399aa65f434065e043819be254f (patch) | |
tree | c4d9c1260963ba0c35fbf1387060c6a7f423c940 /cmd/monfront | |
parent | 02e838e2fec4bb38d4efeff5ea64ff8a9a5e3668 (diff) |
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.
Diffstat (limited to 'cmd/monfront')
-rw-r--r-- | cmd/monfront/main.go | 18 |
1 files 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; |